Fix parsing of `:matches-attr` arguments

Related feedback:
- https://github.com/uBlockOrigin/uBlock-issues/issues/2329#issuecomment-1341349992
This commit is contained in:
Raymond Hill 2022-12-07 14:15:01 -05:00
parent 1bda7e0085
commit bbf06ad972
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2
1 changed files with 7 additions and 4 deletions

View File

@ -1919,7 +1919,7 @@ Parser.prototype.SelectorCompiler = class {
if ( i === end ) { break; }
c = s.charCodeAt(i);
if ( c !== 0x5C && c !== quote ) {
out.push('\\');
out.push(0x5C);
}
}
out.push(c);
@ -1944,10 +1944,13 @@ Parser.prototype.SelectorCompiler = class {
} else {
attr = r.s;
if ( s.charCodeAt(r.i) !== 0x3D ) { return; }
r = this.unquoteString(s.slice(r.i+1));
value = r.s;
value = s.slice(r.i+1);
}
if ( attr === '' ) { return; }
if ( value.length !== 0 ) {
r = this.unquoteString(value);
value = r.s;
}
return { attr, value };
}