Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: lib/content/elemHideEmulation.js

Issue 29730630: Issue 6437 - Skip DOM-only patterns on initial load (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Patch Set: Created March 22, 2018, 4:09 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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;
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld