mirror of https://github.com/gorhill/uBlock.git
Properly handle unsupported `nth-child(an of selector)
Related feedback: - https://github.com/uBlockOrigin/uBlock-issues/issues/2284#issuecomment-1280325910
This commit is contained in:
parent
25b0a2c90c
commit
04119e9cdd
|
@ -1614,6 +1614,7 @@ Parser.prototype.SelectorCompiler = class {
|
||||||
out.push(`#${data.name}`);
|
out.push(`#${data.name}`);
|
||||||
break;
|
break;
|
||||||
case 'Nth': {
|
case 'Nth': {
|
||||||
|
if ( data.selector !== null ) { return; }
|
||||||
if ( data.nth.type === 'AnPlusB' ) {
|
if ( data.nth.type === 'AnPlusB' ) {
|
||||||
const a = parseInt(data.nth.a, 10) || null;
|
const a = parseInt(data.nth.a, 10) || null;
|
||||||
const b = parseInt(data.nth.b, 10) || null;
|
const b = parseInt(data.nth.b, 10) || null;
|
||||||
|
@ -1637,7 +1638,9 @@ Parser.prototype.SelectorCompiler = class {
|
||||||
case 'PseudoElementSelector':
|
case 'PseudoElementSelector':
|
||||||
out.push(`:${data.name}`);
|
out.push(`:${data.name}`);
|
||||||
if ( Array.isArray(part.args) ) {
|
if ( Array.isArray(part.args) ) {
|
||||||
out.push(`(${this.astSerialize(part.args)})`);
|
const arg = this.astSerialize(part.args);
|
||||||
|
if ( typeof arg !== 'string' ) { return; }
|
||||||
|
out.push(`(${arg})`);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'Raw':
|
case 'Raw':
|
||||||
|
|
Loading…
Reference in New Issue