mirror of
https://github.com/gorhill/uBlock.git
synced 2026-03-11 09:04:36 +00:00
Remove the need for parethesis for JSONPath filter selectors
As per official proposed standard: https://www.rfc-editor.org/rfc/rfc9535.html#name-filter-selector
This commit is contained in:
parent
cdb1afc3b2
commit
9adedbc30e
1 changed files with 6 additions and 6 deletions
|
|
@ -147,7 +147,7 @@ export class JSONPath {
|
|||
#CHILDREN = 3;
|
||||
#DESCENDANTS = 4;
|
||||
#reUnquotedIdentifier = /^[A-Za-z_][\w]*|^\*/;
|
||||
#reExpr = /^([!=^$*]=|[<>]=?)(.+?)\)\]/;
|
||||
#reExpr = /^([!=^$*]=|[<>]=?)(.+?)\]/;
|
||||
#reIndice = /^-?\d+/;
|
||||
#root;
|
||||
#compiled;
|
||||
|
|
@ -192,15 +192,15 @@ export class JSONPath {
|
|||
continue;
|
||||
}
|
||||
// Bracket accessor syntax
|
||||
if ( query.startsWith('[?(', i) ) {
|
||||
const not = query.charCodeAt(i+3) === 0x21 /* ! */;
|
||||
const j = i + 3 + (not ? 1 : 0);
|
||||
if ( query.startsWith('[?', i) ) {
|
||||
const not = query.charCodeAt(i+2) === 0x21 /* ! */;
|
||||
const j = i + 2 + (not ? 1 : 0);
|
||||
const r = this.#compile(query, j);
|
||||
if ( r === undefined ) { return; }
|
||||
if ( query.startsWith(')]', r.i) === false ) { return; }
|
||||
if ( query.startsWith(']', r.i) === false ) { return; }
|
||||
if ( not ) { r.steps.at(-1).not = true; }
|
||||
steps.push({ mv: mv || this.#CHILDREN, steps: r.steps });
|
||||
i = r.i + 2;
|
||||
i = r.i + 1;
|
||||
mv = this.#UNDEFINED;
|
||||
continue;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue