 Issue 29490698:
  Issue 5422 - Properly build props selector  (Closed) 
  Base URL: https://hg.adblockplus.org/adblockpluscore/
    
  
    Issue 29490698:
  Issue 5422 - Properly build props selector  (Closed) 
  Base URL: https://hg.adblockplus.org/adblockpluscore/| Left: | ||
| Right: | 
| LEFT | RIGHT | 
|---|---|
| 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 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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("*") && | 283 if (subSelector.startsWith("*") && | 
| 284 !incompletePrefixRegexp.test(prefix)) | 284 !incompletePrefixRegexp.test(prefix)) | 
| 285 { | |
| 285 subSelector = subSelector.substr(1); | 286 subSelector = subSelector.substr(1); | 
| 
Wladimir Palant
2017/08/19 07:39:13
Nit: we require brackets around the if body for mu
 
hub
2017/08/21 15:36:04
Done.
 | |
| 287 } | |
| 286 let idx = subSelector.lastIndexOf("::"); | 288 let idx = subSelector.lastIndexOf("::"); | 
| 287 if (idx != -1) | 289 if (idx != -1) | 
| 288 subSelector = subSelector.substr(0, idx); | 290 subSelector = subSelector.substr(0, idx); | 
| 289 yield prefix + subSelector; | 291 yield prefix + subSelector; | 
| 290 } | 292 } | 
| 291 }, | 293 }, | 
| 292 | 294 | 
| 293 *getSelectors(prefix, subtree, styles) | 295 *getSelectors(prefix, subtree, styles) | 
| 294 { | 296 { | 
| 295 for (let selector of this.findPropsSelectors(styles, prefix, this._regexp)) | 297 for (let selector of this.findPropsSelectors(styles, prefix, this._regexp)) | 
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 508 | 510 | 
| 509 if (this.patterns.length > 0) | 511 if (this.patterns.length > 0) | 
| 510 { | 512 { | 
| 511 let {document} = this.window; | 513 let {document} = this.window; | 
| 512 this.addSelectors(); | 514 this.addSelectors(); | 
| 513 document.addEventListener("load", this.onLoad.bind(this), true); | 515 document.addEventListener("load", this.onLoad.bind(this), true); | 
| 514 } | 516 } | 
| 515 }); | 517 }); | 
| 516 } | 518 } | 
| 517 }; | 519 }; | 
| LEFT | RIGHT |