mirror of https://github.com/gorhill/uBlock.git
code review: do not delay injection of specific cosmetic filters
This commit is contained in:
parent
4da4709ed5
commit
788ff0a21f
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue