Skip to content

Commit

Permalink
[mv3] Fixed undue delay in 1st application of cosmetic procedural fil…
Browse files Browse the repository at this point in the history
…ters

Related feedback:
- uBlockOrigin/uBlock-issues#2261 (comment)
  • Loading branch information
gorhill committed Nov 10, 2022
1 parent 5b6fc43 commit 7d07149
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions platform/mv3/extension/js/scripting/css-procedural.js
Expand Up @@ -486,6 +486,9 @@ class ProceduralFilterer {
this.styledNodes = new Set();
this.timer = undefined;
this.addSelectors(selectors);
// Important: commit now (do not go through onDOMChanged) to be sure
// first pass is going to happen asap.
this.uBOL_commitNow();
}

addSelectors() {
Expand All @@ -506,8 +509,6 @@ class ProceduralFilterer {
}

uBOL_commitNow() {
//console.time('procedural selectors/dom layout changed');

// https://github.com/uBlockOrigin/uBlock-issues/issues/341
// Be ready to unhide nodes which no longer matches any of
// the procedural selectors.
Expand Down Expand Up @@ -554,8 +555,8 @@ class ProceduralFilterer {
styleNodes(nodes, styleToken) {
if ( styleToken === undefined ) {
for ( const node of nodes ) {
node.textContent = '';
node.remove();
node.textContent = '';
}
return;
}
Expand Down

0 comments on commit 7d07149

Please sign in to comment.