mirror of https://github.com/gorhill/uBlock.git
Fix regression in handling of procedural cosmetic filters
Related commit:
- 91caed32d3
Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/2185#issuecomment-1193862432
This commit is contained in:
parent
a40eb5a40e
commit
e2043b6554
|
@ -828,7 +828,8 @@ FilterContainer.prototype.cssRuleFromProcedural = function(json) {
|
|||
if ( pfilter.cssable !== true ) { return; }
|
||||
const { tasks, action } = pfilter;
|
||||
let mq;
|
||||
if ( tasks !== undefined && tasks.length === 1 ) {
|
||||
if ( tasks !== undefined ) {
|
||||
if ( tasks.length > 1 ) { return; }
|
||||
if ( tasks[0][0] !== ':matches-media' ) { return; }
|
||||
mq = tasks[0][1];
|
||||
}
|
||||
|
|
|
@ -1862,9 +1862,6 @@ Parser.prototype.SelectorCompiler = class {
|
|||
}
|
||||
|
||||
const out = { selector: prefix };
|
||||
if ( root && this.sheetSelectable(prefix) ) {
|
||||
out.cssable = true;
|
||||
}
|
||||
|
||||
if ( tasks.length !== 0 ) {
|
||||
out.tasks = tasks;
|
||||
|
@ -1875,6 +1872,19 @@ Parser.prototype.SelectorCompiler = class {
|
|||
out.action = action;
|
||||
}
|
||||
|
||||
// Flag to quickly find out whether the filter can be converted into
|
||||
// a declarative CSS rule.
|
||||
if (
|
||||
root &&
|
||||
(action === undefined || action[0] === ':style') &&
|
||||
(
|
||||
tasks.length === 0 ||
|
||||
tasks.length === 1 && tasks[0][0] === ':matches-media'
|
||||
)
|
||||
) {
|
||||
out.cssable = this.sheetSelectable(prefix);
|
||||
}
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue