mirror of
https://github.com/gorhill/uBlock.git
synced 2024-09-03 17:49:39 +02:00
Reject improper use of procedural operator in selector list
Related feedback: - https://github.com/uBlockOrigin/uBlock-issues/issues/382#issuecomment-703725346
This commit is contained in:
parent
42c0f66c6e
commit
57048d57b2
@ -1372,9 +1372,9 @@ Parser.prototype.SelectorCompiler = class {
|
||||
return { name: name, value: regexDetails };
|
||||
}
|
||||
|
||||
// https://github.com/AdguardTeam/ExtendedCss/issues/31#issuecomment-302391277
|
||||
// Prepend `:scope ` if needed.
|
||||
compileConditionalSelector(s) {
|
||||
// https://github.com/AdguardTeam/ExtendedCss/issues/31#issuecomment-302391277
|
||||
// Prepend `:scope ` if needed.
|
||||
if ( this.reNeedScope.test(s) ) {
|
||||
s = `:scope ${s}`;
|
||||
}
|
||||
@ -1388,11 +1388,11 @@ Parser.prototype.SelectorCompiler = class {
|
||||
return n;
|
||||
}
|
||||
|
||||
// https://github.com/uBlockOrigin/uBlock-issues/issues/341#issuecomment-447603588
|
||||
// Reject instances of :not() filters for which the argument is
|
||||
// a valid CSS selector, otherwise we would be adversely
|
||||
// changing the behavior of CSS4's :not().
|
||||
compileNotSelector(s) {
|
||||
// https://github.com/uBlockOrigin/uBlock-issues/issues/341#issuecomment-447603588
|
||||
// Reject instances of :not() filters for which the argument is
|
||||
// a valid CSS selector, otherwise we would be adversely
|
||||
// changing the behavior of CSS4's :not().
|
||||
if ( this.cssSelectorType(s) === 0 ) {
|
||||
return this.compileConditionalSelector(s);
|
||||
}
|
||||
@ -1408,8 +1408,10 @@ Parser.prototype.SelectorCompiler = class {
|
||||
if ( s === '' ) { return s; }
|
||||
}
|
||||
|
||||
// https://github.com/uBlockOrigin/uBlock-issues/issues/382#issuecomment-703725346
|
||||
// Prepend `*` only when it can be deemed implicit.
|
||||
compileSpathExpression(s) {
|
||||
if ( this.cssSelectorType('*' + s) === 1 ) {
|
||||
if ( this.cssSelectorType(/^\s*[+:>~]/.test(s) ? '*' + s : s) === 1 ) {
|
||||
return s;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user