| 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 705 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 716 | 716 |
| 717 // If neither any style sheets nor any DOM mutations have been specified, | 717 // If neither any style sheets nor any DOM mutations have been specified, |
| 718 // do full processing. | 718 // do full processing. |
| 719 if (!stylesheets && !mutations) | 719 if (!stylesheets && !mutations) |
| 720 stylesheets = this.document.styleSheets; | 720 stylesheets = this.document.styleSheets; |
| 721 | 721 |
| 722 // If there are any DOM mutations and any of the patterns depends on both | 722 // If there are any DOM mutations and any of the patterns depends on both |
| 723 // style sheets and the DOM (e.g. -abp-has(-abp-properties)), find all the | 723 // style sheets and the DOM (e.g. -abp-has(-abp-properties)), find all the |
| 724 // rules in every style sheet in the document, because we need to run | 724 // rules in every style sheet in the document, because we need to run |
| 725 // querySelectorAll afterwards. On the other hand, if we only have patterns | 725 // querySelectorAll afterwards. On the other hand, if we only have patterns |
| 726 // that depend on either styles or DOM both not both | 726 // that depend on either styles or DOM both not both (e.g. -abp-contains), |
| 727 // (e.g. -abp-properties or -abp-contains), we can skip this part. | 727 // we can skip this part. |
| 728 if (mutations && patterns.some(pattern => pattern.dependsOnStylesAndDOM)) | 728 if (mutations && patterns.some(pattern => pattern.dependsOnStylesAndDOM)) |
| 729 stylesheets = this.document.styleSheets; | 729 stylesheets = this.document.styleSheets; |
| 730 | 730 |
| 731 for (let stylesheet of stylesheets || []) | 731 for (let stylesheet of stylesheets || []) |
| 732 { | 732 { |
| 733 // Explicitly ignore third-party stylesheets to ensure consistent behavior | 733 // Explicitly ignore third-party stylesheets to ensure consistent behavior |
| 734 // between Firefox and Chrome. | 734 // between Firefox and Chrome. |
| 735 if (!this.isSameOrigin(stylesheet)) | 735 if (!this.isSameOrigin(stylesheet)) |
| 736 continue; | 736 continue; |
| 737 | 737 |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 979 characterData: shouldObserveCharacterData(this.patterns), | 979 characterData: shouldObserveCharacterData(this.patterns), |
| 980 subtree: true | 980 subtree: true |
| 981 } | 981 } |
| 982 ); | 982 ); |
| 983 this.document.addEventListener("load", this.onLoad.bind(this), true); | 983 this.document.addEventListener("load", this.onLoad.bind(this), true); |
| 984 } | 984 } |
| 985 } | 985 } |
| 986 }; | 986 }; |
| 987 | 987 |
| 988 exports.ElemHideEmulation = ElemHideEmulation; | 988 exports.ElemHideEmulation = ElemHideEmulation; |
| OLD | NEW |