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 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
449 return getCachedPropertyValue( | 449 return getCachedPropertyValue( |
450 this, "_dependsOnCharacterData", | 450 this, "_dependsOnCharacterData", |
451 () => this.selectors.some(selector => selector.dependsOnCharacterData) | 451 () => this.selectors.some(selector => selector.dependsOnCharacterData) |
452 ); | 452 ); |
453 } | 453 } |
454 }; | 454 }; |
455 | 455 |
456 function filterPatterns(patterns, {stylesheets, mutations}) | 456 function filterPatterns(patterns, {stylesheets, mutations}) |
457 { | 457 { |
458 if (!stylesheets && !mutations) | 458 if (!stylesheets && !mutations) |
459 return patterns.slice(); | 459 return patterns.filter(pattern => pattern.dependsOnStyles); |
460 | 460 |
461 return patterns.filter( | 461 return patterns.filter( |
462 pattern => (stylesheets && pattern.dependsOnStyles) || | 462 pattern => (stylesheets && pattern.dependsOnStyles) || |
463 (mutations && pattern.dependsOnDOM) | 463 (mutations && pattern.dependsOnDOM) |
464 ); | 464 ); |
465 } | 465 } |
466 | 466 |
467 function shouldObserveAttributes(patterns) | 467 function shouldObserveAttributes(patterns) |
468 { | 468 { |
469 return patterns.some(pattern => pattern.maybeDependsOnAttributes); | 469 return patterns.some(pattern => pattern.maybeDependsOnAttributes); |
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
808 characterData: shouldObserveCharacterData(this.patterns), | 808 characterData: shouldObserveCharacterData(this.patterns), |
809 subtree: true | 809 subtree: true |
810 } | 810 } |
811 ); | 811 ); |
812 this.document.addEventListener("load", this.onLoad.bind(this), true); | 812 this.document.addEventListener("load", this.onLoad.bind(this), true); |
813 } | 813 } |
814 } | 814 } |
815 }; | 815 }; |
816 | 816 |
817 exports.ElemHideEmulation = ElemHideEmulation; | 817 exports.ElemHideEmulation = ElemHideEmulation; |
OLD | NEW |