Left: | ||
Right: |
OLD | NEW |
---|---|
1 /* | 1 /* |
2 * This file is part of Adblock Plus <https://adblockplus.org/>, | 2 * This file is part of Adblock Plus <https://adblockplus.org/>, |
3 * Copyright (C) 2006-2017 eyeo GmbH | 3 * Copyright (C) 2006-2017 eyeo GmbH |
4 * | 4 * |
5 * Adblock Plus is free software: you can redistribute it and/or modify | 5 * Adblock Plus is free software: you can redistribute it and/or modify |
6 * it under the terms of the GNU General Public License version 3 as | 6 * it under the terms of the GNU General Public License version 3 as |
7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
8 * | 8 * |
9 * Adblock Plus is distributed in the hope that it will be useful, | 9 * Adblock Plus is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
273 PropsSelector.prototype = { | 273 PropsSelector.prototype = { |
274 preferHideWithSelector: true, | 274 preferHideWithSelector: true, |
275 dependsOnStyles: true, | 275 dependsOnStyles: true, |
276 | 276 |
277 *findPropsSelectors(styles, prefix, regexp) | 277 *findPropsSelectors(styles, prefix, regexp) |
278 { | 278 { |
279 for (let style of styles) | 279 for (let style of styles) |
280 if (regexp.test(style.style)) | 280 if (regexp.test(style.style)) |
281 for (let subSelector of style.subSelectors) | 281 for (let subSelector of style.subSelectors) |
282 { | 282 { |
283 if (subSelector.startsWith("*")) | |
284 if (!incompletePrefixRegexp.test(prefix)) | |
Wladimir Palant
2017/08/17 08:53:08
Please use && operator instead of nested ifs.
hub
2017/08/19 02:12:51
Done.
| |
285 subSelector = subSelector.substr(1); | |
283 let idx = subSelector.lastIndexOf("::"); | 286 let idx = subSelector.lastIndexOf("::"); |
284 if (idx != -1) | 287 if (idx != -1) |
285 subSelector = subSelector.substr(0, idx); | 288 subSelector = subSelector.substr(0, idx); |
286 yield prefix + subSelector; | 289 yield prefix + subSelector; |
287 } | 290 } |
288 }, | 291 }, |
289 | 292 |
290 *getSelectors(prefix, subtree, styles) | 293 *getSelectors(prefix, subtree, styles) |
291 { | 294 { |
292 for (let selector of this.findPropsSelectors(styles, prefix, this._regexp)) | 295 for (let selector of this.findPropsSelectors(styles, prefix, this._regexp)) |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
505 | 508 |
506 if (this.patterns.length > 0) | 509 if (this.patterns.length > 0) |
507 { | 510 { |
508 let {document} = this.window; | 511 let {document} = this.window; |
509 this.addSelectors(); | 512 this.addSelectors(); |
510 document.addEventListener("load", this.onLoad.bind(this), true); | 513 document.addEventListener("load", this.onLoad.bind(this), true); |
511 } | 514 } |
512 }); | 515 }); |
513 } | 516 } |
514 }; | 517 }; |
OLD | NEW |