Skip to content

Commit 7d07149

Browse files
committed
[mv3] Fixed undue delay in 1st application of cosmetic procedural filters
Related feedback: - uBlockOrigin/uBlock-issues#2261 (comment)
1 parent 5b6fc43 commit 7d07149

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

platform/mv3/extension/js/scripting/css-procedural.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -486,6 +486,9 @@ class ProceduralFilterer {
486486
this.styledNodes = new Set();
487487
this.timer = undefined;
488488
this.addSelectors(selectors);
489+
// Important: commit now (do not go through onDOMChanged) to be sure
490+
// first pass is going to happen asap.
491+
this.uBOL_commitNow();
489492
}
490493

491494
addSelectors() {
@@ -506,8 +509,6 @@ class ProceduralFilterer {
506509
}
507510

508511
uBOL_commitNow() {
509-
//console.time('procedural selectors/dom layout changed');
510-
511512
// https://github.com/uBlockOrigin/uBlock-issues/issues/341
512513
// Be ready to unhide nodes which no longer matches any of
513514
// the procedural selectors.
@@ -554,8 +555,8 @@ class ProceduralFilterer {
554555
styleNodes(nodes, styleToken) {
555556
if ( styleToken === undefined ) {
556557
for ( const node of nodes ) {
557-
node.textContent = '';
558558
node.remove();
559+
node.textContent = '';
559560
}
560561
return;
561562
}

0 commit comments

Comments
 (0)