1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-10-06 09:37:12 +02:00

code review: do not delay injection of specific cosmetic filters

This commit is contained in:
gorhill 2016-07-26 08:21:03 -04:00
parent 4da4709ed5
commit 788ff0a21f

View File

@ -346,15 +346,18 @@ var domFilterer = {
}
},
commit: function(nodes) {
if ( stagedNodes.length === 0 ) {
window.requestAnimationFrame(this.commit_.bind(this));
}
commit: function(nodes, commitNow) {
var firstCommit = stagedNodes.length === 0;
if ( nodes === undefined ) {
stagedNodes = [ document.documentElement ];
} else if ( stagedNodes[0] !== document.documentElement ) {
stagedNodes = stagedNodes.concat(nodes);
}
if ( commitNow ) {
this.commit_();
} else if ( firstCommit ) {
window.requestAnimationFrame(this.commit_.bind(this));
}
},
hideNode: function(node) {
@ -562,7 +565,7 @@ return domFilterer;
domFilterer.addExceptions(details.cosmeticDonthide);
// https://github.com/chrisaljoudi/uBlock/issues/143
domFilterer.addSelectors(details.cosmeticHide);
domFilterer.commit();
domFilterer.commit(undefined, true);
};
var netFilters = function(details) {