mirror of https://github.com/gorhill/uBlock.git
fix https://github.com/uBlockOrigin/uBlock-issues/issues/341, and further work for https://github.com/gorhill/uBlock/issues/3683
This commit is contained in:
parent
932c13bfa0
commit
8f05a2f8d3
|
@ -487,6 +487,7 @@ vAPI.DOMFilterer = (function() {
|
|||
[ ':matches-css', PSelectorMatchesCSSTask ],
|
||||
[ ':matches-css-after', PSelectorMatchesCSSAfterTask ],
|
||||
[ ':matches-css-before', PSelectorMatchesCSSBeforeTask ],
|
||||
[ ':not', PSelectorIfNotTask ],
|
||||
[ ':xpath', PSelectorXpathTask ]
|
||||
]);
|
||||
}
|
||||
|
|
|
@ -31,6 +31,9 @@
|
|||
};
|
||||
|
||||
LogEntry.prototype.init = function(details) {
|
||||
if ( details.tstamp === undefined ) {
|
||||
details.tstamp = Date.now();
|
||||
}
|
||||
this.details = JSON.stringify(details);
|
||||
};
|
||||
|
||||
|
|
|
@ -159,6 +159,7 @@
|
|||
'matches-css',
|
||||
'matches-css-after',
|
||||
'matches-css-before',
|
||||
'not',
|
||||
'xpath'
|
||||
].join('|'),
|
||||
')\\('
|
||||
|
@ -209,6 +210,9 @@
|
|||
};
|
||||
|
||||
var compileConditionalSelector = function(s) {
|
||||
if ( isValidCSSSelector(s) ) {
|
||||
return { selector: s, tasks: [] };
|
||||
}
|
||||
// https://github.com/AdguardTeam/ExtendedCss/issues/31#issuecomment-302391277
|
||||
// Prepend `:scope ` if needed.
|
||||
if ( reNeedScope.test(s) ) {
|
||||
|
@ -241,6 +245,7 @@
|
|||
[ ':matches-css', compileCSSDeclaration ],
|
||||
[ ':matches-css-after', compileCSSDeclaration ],
|
||||
[ ':matches-css-before', compileCSSDeclaration ],
|
||||
[ ':not', compileConditionalSelector ],
|
||||
[ ':xpath', compileXpathExpression ]
|
||||
]);
|
||||
|
||||
|
@ -293,7 +298,8 @@
|
|||
raw.push(':has', '(', decompile(task[1]), ')');
|
||||
break;
|
||||
case ':if-not':
|
||||
raw.push(task[0], '(', decompile(task[1]), ')');
|
||||
case ':not':
|
||||
raw.push(':not', '(', decompile(task[1]), ')');
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue