| 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 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 243 for (let element of this.getElements(prefix, subtree, stylesheet)) | 243 for (let element of this.getElements(prefix, subtree, stylesheet)) |
| 244 yield [makeSelector(element, ""), subtree]; | 244 yield [makeSelector(element, ""), subtree]; |
| 245 }, | 245 }, |
| 246 | 246 |
| 247 *getElements(prefix, subtree, stylesheet) | 247 *getElements(prefix, subtree, stylesheet) |
| 248 { | 248 { |
| 249 let actualPrefix = (!prefix || incompletePrefixRegexp.test(prefix)) ? | 249 let actualPrefix = (!prefix || incompletePrefixRegexp.test(prefix)) ? |
| 250 prefix + "*" : prefix; | 250 prefix + "*" : prefix; |
| 251 let elements = subtree.querySelectorAll(actualPrefix); | 251 let elements = subtree.querySelectorAll(actualPrefix); |
| 252 for (let element of elements) | 252 for (let element of elements) |
| 253 if (element.textContent.indexOf(this._text) != -1) | 253 if (element.textContent.includes(this._text)) |
|
Wladimir Palant
2017/06/28 14:53:58
Nit: Please use .includes() rather than .indexOf()
hub
2017/06/28 16:11:35
Done.
| |
| 254 yield element; | 254 yield element; |
| 255 } | 255 } |
| 256 }; | 256 }; |
| 257 | 257 |
| 258 function PropsSelector(propertyExpression) | 258 function PropsSelector(propertyExpression) |
| 259 { | 259 { |
| 260 let regexpString; | 260 let regexpString; |
| 261 if (propertyExpression.length >= 2 && propertyExpression[0] == "/" && | 261 if (propertyExpression.length >= 2 && propertyExpression[0] == "/" && |
| 262 propertyExpression[propertyExpression.length - 1] == "/") | 262 propertyExpression[propertyExpression.length - 1] == "/") |
| 263 { | 263 { |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 455 | 455 |
| 456 if (this.patterns.length > 0) | 456 if (this.patterns.length > 0) |
| 457 { | 457 { |
| 458 let {document} = this.window; | 458 let {document} = this.window; |
| 459 this.addSelectors(document.styleSheets); | 459 this.addSelectors(document.styleSheets); |
| 460 document.addEventListener("load", this.onLoad.bind(this), true); | 460 document.addEventListener("load", this.onLoad.bind(this), true); |
| 461 } | 461 } |
| 462 }); | 462 }); |
| 463 } | 463 } |
| 464 }; | 464 }; |
| LEFT | RIGHT |