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-present eyeo GmbH | 3 * Copyright (C) 2006-present 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 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
301 | 301 |
302 function ContainsSelector(textContent) | 302 function ContainsSelector(textContent) |
303 { | 303 { |
304 this._regexp = makeRegExpParameter(textContent); | 304 this._regexp = makeRegExpParameter(textContent); |
305 } | 305 } |
306 | 306 |
307 ContainsSelector.prototype = { | 307 ContainsSelector.prototype = { |
308 requiresHiding: true, | 308 requiresHiding: true, |
309 dependsOnCharacterData: true, | 309 dependsOnCharacterData: true, |
310 | 310 |
311 *getSelectors(prefix, subtree, stylesheet) | 311 *getSelectors(prefix, subtree, styles) |
312 { | 312 { |
313 for (let element of this.getElements(prefix, subtree, stylesheet)) | 313 for (let element of this.getElements(prefix, subtree, styles)) |
314 yield [makeSelector(element, ""), subtree]; | 314 yield [makeSelector(element, ""), subtree]; |
315 }, | 315 }, |
316 | 316 |
317 *getElements(prefix, subtree, stylesheet) | 317 *getElements(prefix, subtree, styles) |
318 { | 318 { |
319 let actualPrefix = (!prefix || incompletePrefixRegexp.test(prefix)) ? | 319 let actualPrefix = (!prefix || incompletePrefixRegexp.test(prefix)) ? |
320 prefix + "*" : prefix; | 320 prefix + "*" : prefix; |
321 | 321 |
322 let elements = scopedQuerySelectorAll(subtree, actualPrefix); | 322 let elements = scopedQuerySelectorAll(subtree, actualPrefix); |
323 if (elements) | 323 if (elements) |
324 { | 324 { |
325 for (let element of elements) | 325 for (let element of elements) |
326 { | 326 { |
327 if (this._regexp && this._regexp.test(element.textContent)) | 327 if (this._regexp && this._regexp.test(element.textContent)) |
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
712 characterData: shouldObserveCharacterData(this.patterns), | 712 characterData: shouldObserveCharacterData(this.patterns), |
713 subtree: true | 713 subtree: true |
714 } | 714 } |
715 ); | 715 ); |
716 this.document.addEventListener("load", this.onLoad.bind(this), true); | 716 this.document.addEventListener("load", this.onLoad.bind(this), true); |
717 } | 717 } |
718 } | 718 } |
719 }; | 719 }; |
720 | 720 |
721 exports.ElemHideEmulation = ElemHideEmulation; | 721 exports.ElemHideEmulation = ElemHideEmulation; |
OLD | NEW |