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 775 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
786 | 786 |
787 let evaluationTargets = targets; | 787 let evaluationTargets = targets; |
788 | 788 |
789 // If the pattern appears to contain any sibling combinators, we can't | 789 // If the pattern appears to contain any sibling combinators, we can't |
790 // easily optimize based on the mutation targets. Since this is a | 790 // easily optimize based on the mutation targets. Since this is a |
791 // special case, skip the optimization. By setting it to null here we | 791 // special case, skip the optimization. By setting it to null here we |
792 // make sure we process the entire DOM. | 792 // make sure we process the entire DOM. |
793 if (pattern.maybeContainsSiblingCombinators) | 793 if (pattern.maybeContainsSiblingCombinators) |
794 evaluationTargets = null; | 794 evaluationTargets = null; |
795 | 795 |
796 // Ignore mutation targets when using style sheets, because we may have | |
797 // to update all the CSS selectors. | |
798 if (!this.useInlineStyles) | |
799 evaluationTargets = null; | |
800 | |
801 generator = evaluate(pattern.selectors, 0, "", | 796 generator = evaluate(pattern.selectors, 0, "", |
802 this.document, cssStyles, evaluationTargets); | 797 this.document, cssStyles, evaluationTargets); |
803 } | 798 } |
804 for (let selector of generator) | 799 for (let selector of generator) |
805 { | 800 { |
806 if (selector != null) | 801 if (selector != null) |
807 { | 802 { |
808 for (let element of this.document.querySelectorAll(selector)) | 803 for (let element of this.document.querySelectorAll(selector)) |
809 { | 804 { |
810 elements.push(element); | 805 elements.push(element); |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
970 characterData: shouldObserveCharacterData(this.patterns), | 965 characterData: shouldObserveCharacterData(this.patterns), |
971 subtree: true | 966 subtree: true |
972 } | 967 } |
973 ); | 968 ); |
974 this.document.addEventListener("load", this.onLoad.bind(this), true); | 969 this.document.addEventListener("load", this.onLoad.bind(this), true); |
975 } | 970 } |
976 } | 971 } |
977 }; | 972 }; |
978 | 973 |
979 exports.ElemHideEmulation = ElemHideEmulation; | 974 exports.ElemHideEmulation = ElemHideEmulation; |
LEFT | RIGHT |