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.masterToken}][${styleToken}]`,
|
||||
style,
|
||||
{ silent: true }
|
||||
{ silent: true, mustInject: true }
|
||||
);
|
||||
return styleToken;
|
||||
}
|
||||
@ -908,7 +908,6 @@ vAPI.injectScriptlet = function(doc, text) {
|
||||
this.disabled = false;
|
||||
this.listeners = [];
|
||||
this.filterset = new Set();
|
||||
this.addedCSSRules = new Set();
|
||||
this.exceptedCSSRules = [];
|
||||
this.exceptions = [];
|
||||
this.proceduralFilterer = null;
|
||||
@ -932,19 +931,8 @@ vAPI.injectScriptlet = function(doc, text) {
|
||||
? selectors.join(',\n')
|
||||
: selectors;
|
||||
if ( selectorsStr.length === 0 ) { return; }
|
||||
const entry = {
|
||||
selectors: selectorsStr,
|
||||
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
|
||||
) {
|
||||
this.filterset.add({ selectors: selectorsStr, declarations });
|
||||
if ( details.mustInject && this.disabled === false ) {
|
||||
vAPI.userStylesheet.add(`${selectorsStr}\n{${declarations}}`);
|
||||
}
|
||||
this.commit();
|
||||
@ -1012,20 +1000,7 @@ vAPI.injectScriptlet = function(doc, text) {
|
||||
commitNow() {
|
||||
this.commitTimer.clear();
|
||||
if ( vAPI instanceof Object === false ) { return; }
|
||||
const userStylesheet = vAPI.userStylesheet;
|
||||
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();
|
||||
vAPI.userStylesheet.apply();
|
||||
if ( this.proceduralFilterer instanceof Object ) {
|
||||
this.proceduralFilterer.commitNow();
|
||||
}
|
||||
@ -1059,11 +1034,11 @@ vAPI.injectScriptlet = function(doc, text) {
|
||||
o.action[0] === ':style' &&
|
||||
o.tasks === undefined
|
||||
) {
|
||||
this.addCSSRule(o.selector, o.action[1]);
|
||||
this.addCSSRule(o.selector, o.action[1], { mustInject: true });
|
||||
continue;
|
||||
}
|
||||
if ( o.pseudo !== undefined ) {
|
||||
this.addCSSRule(o.selector, vAPI.hideStyle);
|
||||
this.addCSSRule(o.selector, vAPI.hideStyle, { mustInject: true });
|
||||
continue;
|
||||
}
|
||||
procedurals.push(o);
|
||||
@ -1550,11 +1525,7 @@ vAPI.injectScriptlet = function(doc, text) {
|
||||
if ( result ) {
|
||||
let selectors = result.injected;
|
||||
if ( typeof selectors === 'string' && selectors.length !== 0 ) {
|
||||
domFilterer.addCSSRule(
|
||||
selectors,
|
||||
vAPI.hideStyle,
|
||||
{ injected: true }
|
||||
);
|
||||
domFilterer.addCSSRule(selectors, vAPI.hideStyle);
|
||||
mustCommit = true;
|
||||
}
|
||||
selectors = result.excepted;
|
||||
@ -1722,11 +1693,7 @@ vAPI.injectScriptlet = function(doc, text) {
|
||||
vAPI.domSurveyor = null;
|
||||
}
|
||||
domFilterer.exceptions = cfeDetails.exceptionFilters;
|
||||
domFilterer.addCSSRule(
|
||||
cfeDetails.injectedHideFilters,
|
||||
vAPI.hideStyle,
|
||||
{ injected: true }
|
||||
);
|
||||
domFilterer.addCSSRule(cfeDetails.injectedHideFilters, vAPI.hideStyle);
|
||||
domFilterer.addProceduralSelectors(cfeDetails.proceduralFilters);
|
||||
domFilterer.exceptCSSRules(cfeDetails.exceptedFilters);
|
||||
}
|
||||
|
@ -805,7 +805,8 @@ const filterToDOMInterface = (( ) => {
|
||||
if ( cssSelectors.size !== 0 ) {
|
||||
vAPI.domFilterer.addCSSRule(
|
||||
Array.from(cssSelectors),
|
||||
vAPI.hideStyle
|
||||
vAPI.hideStyle,
|
||||
{ mustInject: true }
|
||||
);
|
||||
}
|
||||
if ( proceduralSelectors.size !== 0 ) {
|
||||
|
Loading…
Reference in New Issue
Block a user