1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-10-02 23:57:10 +02:00

[mv3] Fixed undue delay in 1st application of cosmetic procedural filters

Related feedback:
- https://github.com/uBlockOrigin/uBlock-issues/discussions/2261#discussioncomment-4105044
This commit is contained in:
Raymond Hill 2022-11-10 15:34:02 -05:00
parent 5b6fc43a2c
commit 7d0714965f
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2

View File

@ -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() {
@ -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.
@ -554,8 +555,8 @@ class ProceduralFilterer {
styleNodes(nodes, styleToken) {
if ( styleToken === undefined ) {
for ( const node of nodes ) {
node.textContent = '';
node.remove();
node.textContent = '';
}
return;
}