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 {
|
vAPI.DOMFilterer = class {
|
||||||
constructor() {
|
constructor() {
|
||||||
this.commitTimer = new vAPI.SafeAnimationFrame(( ) => this.commitNow);
|
this.commitTimer = new vAPI.SafeAnimationFrame(this.commitNow.bind(this));
|
||||||
this.domIsReady = document.readyState !== 'loading';
|
this.domIsReady = document.readyState !== 'loading';
|
||||||
this.disabled = false;
|
this.disabled = false;
|
||||||
this.listeners = [];
|
this.listeners = [];
|
||||||
|
|
|
@ -709,18 +709,17 @@ vAPI.DOMFilterer = (function() {
|
||||||
};
|
};
|
||||||
PSelector.prototype.operatorToTaskMap = undefined;
|
PSelector.prototype.operatorToTaskMap = undefined;
|
||||||
|
|
||||||
const DOMProceduralFilterer = function(domFilterer) {
|
const DOMProceduralFilterer = class {
|
||||||
|
constructor(domFilterer) {
|
||||||
this.domFilterer = domFilterer;
|
this.domFilterer = domFilterer;
|
||||||
this.domIsReady = false;
|
this.domIsReady = false;
|
||||||
this.domIsWatched = false;
|
this.domIsWatched = false;
|
||||||
this.mustApplySelectors = false;
|
this.mustApplySelectors = false;
|
||||||
this.selectors = new Map();
|
this.selectors = new Map();
|
||||||
this.hiddenNodes = new Set();
|
this.hiddenNodes = new Set();
|
||||||
};
|
}
|
||||||
|
|
||||||
DOMProceduralFilterer.prototype = {
|
addProceduralSelectors(aa) {
|
||||||
|
|
||||||
addProceduralSelectors: function(aa) {
|
|
||||||
const addedSelectors = [];
|
const addedSelectors = [];
|
||||||
let mustCommit = this.domIsWatched;
|
let mustCommit = this.domIsWatched;
|
||||||
for ( let i = 0, n = aa.length; i < n; i++ ) {
|
for ( let i = 0, n = aa.length; i < n; i++ ) {
|
||||||
|
@ -757,9 +756,9 @@ vAPI.DOMFilterer = (function() {
|
||||||
procedural: addedSelectors
|
procedural: addedSelectors
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
|
|
||||||
commitNow: function() {
|
commitNow() {
|
||||||
if ( this.selectors.size === 0 || this.domIsReady === false ) {
|
if ( this.selectors.size === 0 || this.domIsReady === false ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -804,18 +803,18 @@ vAPI.DOMFilterer = (function() {
|
||||||
this.domFilterer.unhideNode(node);
|
this.domFilterer.unhideNode(node);
|
||||||
}
|
}
|
||||||
//console.timeEnd('procedural selectors/dom layout changed');
|
//console.timeEnd('procedural selectors/dom layout changed');
|
||||||
},
|
}
|
||||||
|
|
||||||
createProceduralFilter: function(o) {
|
createProceduralFilter(o) {
|
||||||
return new PSelector(o);
|
return new PSelector(o);
|
||||||
},
|
}
|
||||||
|
|
||||||
onDOMCreated: function() {
|
onDOMCreated() {
|
||||||
this.domIsReady = true;
|
this.domIsReady = true;
|
||||||
this.domFilterer.commitNow();
|
this.domFilterer.commitNow();
|
||||||
},
|
}
|
||||||
|
|
||||||
onDOMChanged: function(addedNodes, removedNodes) {
|
onDOMChanged(addedNodes, removedNodes) {
|
||||||
if ( this.selectors.size === 0 ) { return; }
|
if ( this.selectors.size === 0 ) { return; }
|
||||||
this.mustApplySelectors =
|
this.mustApplySelectors =
|
||||||
this.mustApplySelectors ||
|
this.mustApplySelectors ||
|
||||||
|
@ -869,7 +868,7 @@ vAPI.DOMFilterer = (function() {
|
||||||
|
|
||||||
onDOMChanged() {
|
onDOMChanged() {
|
||||||
if ( super.onDOMChanged instanceof Function ) {
|
if ( super.onDOMChanged instanceof Function ) {
|
||||||
super.onDOMChanged(arguments);
|
super.onDOMChanged.apply(this, arguments);
|
||||||
}
|
}
|
||||||
this.proceduralFilterer.onDOMChanged.apply(
|
this.proceduralFilterer.onDOMChanged.apply(
|
||||||
this.proceduralFilterer,
|
this.proceduralFilterer,
|
||||||
|
|
Loading…
Reference in a new issue