mirror of
https://github.com/gorhill/uBlock.git
synced 2024-11-24 11:22:44 +01:00
Remove more remnants of obsolete pseudo user styles code
Related commit:
- 5c68867b92
This commit is contained in:
parent
a42c49d855
commit
3da97673d9
@ -851,7 +851,7 @@ vAPI.injectScriptlet = function(doc, text) {
|
|||||||
this.domFilterer.addCSSRule(
|
this.domFilterer.addCSSRule(
|
||||||
`[${this.masterToken}][${styleToken}]`,
|
`[${this.masterToken}][${styleToken}]`,
|
||||||
style,
|
style,
|
||||||
{ silent: true }
|
{ silent: true, mustInject: true }
|
||||||
);
|
);
|
||||||
return styleToken;
|
return styleToken;
|
||||||
}
|
}
|
||||||
@ -908,7 +908,6 @@ vAPI.injectScriptlet = function(doc, text) {
|
|||||||
this.disabled = false;
|
this.disabled = false;
|
||||||
this.listeners = [];
|
this.listeners = [];
|
||||||
this.filterset = new Set();
|
this.filterset = new Set();
|
||||||
this.addedCSSRules = new Set();
|
|
||||||
this.exceptedCSSRules = [];
|
this.exceptedCSSRules = [];
|
||||||
this.exceptions = [];
|
this.exceptions = [];
|
||||||
this.proceduralFilterer = null;
|
this.proceduralFilterer = null;
|
||||||
@ -932,19 +931,8 @@ vAPI.injectScriptlet = function(doc, text) {
|
|||||||
? selectors.join(',\n')
|
? selectors.join(',\n')
|
||||||
: selectors;
|
: selectors;
|
||||||
if ( selectorsStr.length === 0 ) { return; }
|
if ( selectorsStr.length === 0 ) { return; }
|
||||||
const entry = {
|
this.filterset.add({ selectors: selectorsStr, declarations });
|
||||||
selectors: selectorsStr,
|
if ( details.mustInject && this.disabled === false ) {
|
||||||
declarations,
|
|
||||||
lazy: details.lazy === true,
|
|
||||||
injected: details.injected === true
|
|
||||||
};
|
|
||||||
this.addedCSSRules.add(entry);
|
|
||||||
this.filterset.add(entry);
|
|
||||||
if (
|
|
||||||
this.disabled === false &&
|
|
||||||
entry.lazy !== true &&
|
|
||||||
entry.injected !== true
|
|
||||||
) {
|
|
||||||
vAPI.userStylesheet.add(`${selectorsStr}\n{${declarations}}`);
|
vAPI.userStylesheet.add(`${selectorsStr}\n{${declarations}}`);
|
||||||
}
|
}
|
||||||
this.commit();
|
this.commit();
|
||||||
@ -1012,20 +1000,7 @@ vAPI.injectScriptlet = function(doc, text) {
|
|||||||
commitNow() {
|
commitNow() {
|
||||||
this.commitTimer.clear();
|
this.commitTimer.clear();
|
||||||
if ( vAPI instanceof Object === false ) { return; }
|
if ( vAPI instanceof Object === false ) { return; }
|
||||||
const userStylesheet = vAPI.userStylesheet;
|
vAPI.userStylesheet.apply();
|
||||||
for ( const entry of this.addedCSSRules ) {
|
|
||||||
if (
|
|
||||||
this.disabled === false &&
|
|
||||||
entry.lazy &&
|
|
||||||
entry.injected === false
|
|
||||||
) {
|
|
||||||
userStylesheet.add(
|
|
||||||
`${entry.selectors}\n{${entry.declarations}}`
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
this.addedCSSRules.clear();
|
|
||||||
userStylesheet.apply();
|
|
||||||
if ( this.proceduralFilterer instanceof Object ) {
|
if ( this.proceduralFilterer instanceof Object ) {
|
||||||
this.proceduralFilterer.commitNow();
|
this.proceduralFilterer.commitNow();
|
||||||
}
|
}
|
||||||
@ -1059,11 +1034,11 @@ vAPI.injectScriptlet = function(doc, text) {
|
|||||||
o.action[0] === ':style' &&
|
o.action[0] === ':style' &&
|
||||||
o.tasks === undefined
|
o.tasks === undefined
|
||||||
) {
|
) {
|
||||||
this.addCSSRule(o.selector, o.action[1]);
|
this.addCSSRule(o.selector, o.action[1], { mustInject: true });
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if ( o.pseudo !== undefined ) {
|
if ( o.pseudo !== undefined ) {
|
||||||
this.addCSSRule(o.selector, vAPI.hideStyle);
|
this.addCSSRule(o.selector, vAPI.hideStyle, { mustInject: true });
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
procedurals.push(o);
|
procedurals.push(o);
|
||||||
@ -1550,11 +1525,7 @@ vAPI.injectScriptlet = function(doc, text) {
|
|||||||
if ( result ) {
|
if ( result ) {
|
||||||
let selectors = result.injected;
|
let selectors = result.injected;
|
||||||
if ( typeof selectors === 'string' && selectors.length !== 0 ) {
|
if ( typeof selectors === 'string' && selectors.length !== 0 ) {
|
||||||
domFilterer.addCSSRule(
|
domFilterer.addCSSRule(selectors, vAPI.hideStyle);
|
||||||
selectors,
|
|
||||||
vAPI.hideStyle,
|
|
||||||
{ injected: true }
|
|
||||||
);
|
|
||||||
mustCommit = true;
|
mustCommit = true;
|
||||||
}
|
}
|
||||||
selectors = result.excepted;
|
selectors = result.excepted;
|
||||||
@ -1722,11 +1693,7 @@ vAPI.injectScriptlet = function(doc, text) {
|
|||||||
vAPI.domSurveyor = null;
|
vAPI.domSurveyor = null;
|
||||||
}
|
}
|
||||||
domFilterer.exceptions = cfeDetails.exceptionFilters;
|
domFilterer.exceptions = cfeDetails.exceptionFilters;
|
||||||
domFilterer.addCSSRule(
|
domFilterer.addCSSRule(cfeDetails.injectedHideFilters, vAPI.hideStyle);
|
||||||
cfeDetails.injectedHideFilters,
|
|
||||||
vAPI.hideStyle,
|
|
||||||
{ injected: true }
|
|
||||||
);
|
|
||||||
domFilterer.addProceduralSelectors(cfeDetails.proceduralFilters);
|
domFilterer.addProceduralSelectors(cfeDetails.proceduralFilters);
|
||||||
domFilterer.exceptCSSRules(cfeDetails.exceptedFilters);
|
domFilterer.exceptCSSRules(cfeDetails.exceptedFilters);
|
||||||
}
|
}
|
||||||
|
@ -805,7 +805,8 @@ const filterToDOMInterface = (( ) => {
|
|||||||
if ( cssSelectors.size !== 0 ) {
|
if ( cssSelectors.size !== 0 ) {
|
||||||
vAPI.domFilterer.addCSSRule(
|
vAPI.domFilterer.addCSSRule(
|
||||||
Array.from(cssSelectors),
|
Array.from(cssSelectors),
|
||||||
vAPI.hideStyle
|
vAPI.hideStyle,
|
||||||
|
{ mustInject: true }
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if ( proceduralSelectors.size !== 0 ) {
|
if ( proceduralSelectors.size !== 0 ) {
|
||||||
|
Loading…
Reference in New Issue
Block a user