mirror of
https://github.com/gorhill/uBlock.git
synced 2024-09-04 01:59:38 +02:00
Fix serializing of unquoted attribute values
Related commit: - https://github.com/uBlockOrigin/uBlock-issues/issues/2300
This commit is contained in:
parent
a47484bc33
commit
7379bafb23
@ -1570,18 +1570,23 @@ Parser.prototype.SelectorCompiler = class {
|
||||
}
|
||||
}
|
||||
|
||||
// https://github.com/uBlockOrigin/uBlock-issues/issues/2300
|
||||
// Unquoted atrtibute values are parsed as Identifier instead of String.
|
||||
astSerialize(parts) {
|
||||
const out = [];
|
||||
for ( const part of parts ) {
|
||||
const { data } = part;
|
||||
switch ( data.type ) {
|
||||
case 'AttributeSelector':
|
||||
case 'AttributeSelector': {
|
||||
const name = data.name.name;
|
||||
const value = data.value.value || data.value.name;
|
||||
out.push(
|
||||
data.matcher
|
||||
? `[${data.name.name}${data.matcher}"${data.value.value}"]`
|
||||
: `[${data.name.name}]`
|
||||
? `[${name}${data.matcher}"${value}"]`
|
||||
: `[${name}]`
|
||||
);
|
||||
break;
|
||||
}
|
||||
case 'ClassSelector':
|
||||
out.push(`.${data.name}`);
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user