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-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 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
363 function shouldObserveAttributes(patterns) | 363 function shouldObserveAttributes(patterns) |
364 { | 364 { |
365 // Observe changes to attributes if either there's a plain selector that | 365 // Observe changes to attributes if either there's a plain selector that |
366 // looks like an ID selector, class selector, or attribute selector in one of | 366 // looks like an ID selector, class selector, or attribute selector in one of |
367 // the patterns (e.g. "a[href='https://example.com/']") | 367 // the patterns (e.g. "a[href='https://example.com/']") |
368 // or there's a properties selector nested inside a has selector | 368 // or there's a properties selector nested inside a has selector |
369 // (e.g. "div:-abp-has(:-abp-properties(color: blue))") | 369 // (e.g. "div:-abp-has(:-abp-properties(color: blue))") |
370 return patterns.some( | 370 return patterns.some( |
371 pattern => pattern.selectors.some( | 371 pattern => pattern.selectors.some( |
372 selector => selector.maybeDependsOnAttributes || | 372 selector => selector.maybeDependsOnAttributes || |
373 selector instanceof HasSelector && | 373 (selector instanceof HasSelector && |
374 selector.dependsOnStyles | 374 selector.dependsOnStyles) |
375 ) | 375 ) |
376 ); | 376 ); |
377 } | 377 } |
378 | 378 |
379 function shouldObserveCharacterData(patterns) | 379 function shouldObserveCharacterData(patterns) |
380 { | 380 { |
381 // Observe changes to character data only if there's a contains selector in | 381 // Observe changes to character data only if there's a contains selector in |
382 // one of the patterns. | 382 // one of the patterns. |
383 return patterns.some( | 383 return patterns.some( |
384 pattern => pattern.selectors.some( | 384 pattern => pattern.selectors.some( |
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
689 characterData: shouldObserveCharacterData(this.patterns), | 689 characterData: shouldObserveCharacterData(this.patterns), |
690 subtree: true | 690 subtree: true |
691 } | 691 } |
692 ); | 692 ); |
693 this.document.addEventListener("load", this.onLoad.bind(this), true); | 693 this.document.addEventListener("load", this.onLoad.bind(this), true); |
694 } | 694 } |
695 } | 695 } |
696 }; | 696 }; |
697 | 697 |
698 exports.ElemHideEmulation = ElemHideEmulation; | 698 exports.ElemHideEmulation = ElemHideEmulation; |
LEFT | RIGHT |