mirror of
https://github.com/gorhill/uBlock.git
synced 2024-11-10 09:07:54 +01:00
Fix regression in applying procedural cosmetic filters
Related commit:
- 3573b6b32c
This commit is contained in:
parent
3573b6b32c
commit
1386429382
2 changed files with 20 additions and 21 deletions
|
@ -59,7 +59,7 @@ vAPI.userStylesheet = {
|
|||
|
||||
vAPI.DOMFilterer = class {
|
||||
constructor() {
|
||||
this.commitTimer = new vAPI.SafeAnimationFrame(( ) => this.commitNow);
|
||||
this.commitTimer = new vAPI.SafeAnimationFrame(this.commitNow.bind(this));
|
||||
this.domIsReady = document.readyState !== 'loading';
|
||||
this.disabled = false;
|
||||
this.listeners = [];
|
||||
|
|
|
@ -709,18 +709,17 @@ vAPI.DOMFilterer = (function() {
|
|||
};
|
||||
PSelector.prototype.operatorToTaskMap = undefined;
|
||||
|
||||
const DOMProceduralFilterer = function(domFilterer) {
|
||||
const DOMProceduralFilterer = class {
|
||||
constructor(domFilterer) {
|
||||
this.domFilterer = domFilterer;
|
||||
this.domIsReady = false;
|
||||
this.domIsWatched = false;
|
||||
this.mustApplySelectors = false;
|
||||
this.selectors = new Map();
|
||||
this.hiddenNodes = new Set();
|
||||
};
|
||||
}
|
||||
|
||||
DOMProceduralFilterer.prototype = {
|
||||
|
||||
addProceduralSelectors: function(aa) {
|
||||
addProceduralSelectors(aa) {
|
||||
const addedSelectors = [];
|
||||
let mustCommit = this.domIsWatched;
|
||||
for ( let i = 0, n = aa.length; i < n; i++ ) {
|
||||
|
@ -757,9 +756,9 @@ vAPI.DOMFilterer = (function() {
|
|||
procedural: addedSelectors
|
||||
});
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
commitNow: function() {
|
||||
commitNow() {
|
||||
if ( this.selectors.size === 0 || this.domIsReady === false ) {
|
||||
return;
|
||||
}
|
||||
|
@ -804,18 +803,18 @@ vAPI.DOMFilterer = (function() {
|
|||
this.domFilterer.unhideNode(node);
|
||||
}
|
||||
//console.timeEnd('procedural selectors/dom layout changed');
|
||||
},
|
||||
}
|
||||
|
||||
createProceduralFilter: function(o) {
|
||||
createProceduralFilter(o) {
|
||||
return new PSelector(o);
|
||||
},
|
||||
}
|
||||
|
||||
onDOMCreated: function() {
|
||||
onDOMCreated() {
|
||||
this.domIsReady = true;
|
||||
this.domFilterer.commitNow();
|
||||
},
|
||||
}
|
||||
|
||||
onDOMChanged: function(addedNodes, removedNodes) {
|
||||
onDOMChanged(addedNodes, removedNodes) {
|
||||
if ( this.selectors.size === 0 ) { return; }
|
||||
this.mustApplySelectors =
|
||||
this.mustApplySelectors ||
|
||||
|
@ -869,7 +868,7 @@ vAPI.DOMFilterer = (function() {
|
|||
|
||||
onDOMChanged() {
|
||||
if ( super.onDOMChanged instanceof Function ) {
|
||||
super.onDOMChanged(arguments);
|
||||
super.onDOMChanged.apply(this, arguments);
|
||||
}
|
||||
this.proceduralFilterer.onDOMChanged.apply(
|
||||
this.proceduralFilterer,
|
||||
|
|
Loading…
Reference in a new issue