mirror of
https://github.com/gorhill/uBlock.git
synced 2024-11-23 10:52:43 +01: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) {
|
astSerialize(parts) {
|
||||||
const out = [];
|
const out = [];
|
||||||
for ( const part of parts ) {
|
for ( const part of parts ) {
|
||||||
const { data } = part;
|
const { data } = part;
|
||||||
switch ( data.type ) {
|
switch ( data.type ) {
|
||||||
case 'AttributeSelector':
|
case 'AttributeSelector': {
|
||||||
|
const name = data.name.name;
|
||||||
|
const value = data.value.value || data.value.name;
|
||||||
out.push(
|
out.push(
|
||||||
data.matcher
|
data.matcher
|
||||||
? `[${data.name.name}${data.matcher}"${data.value.value}"]`
|
? `[${name}${data.matcher}"${value}"]`
|
||||||
: `[${data.name.name}]`
|
: `[${name}]`
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
case 'ClassSelector':
|
case 'ClassSelector':
|
||||||
out.push(`.${data.name}`);
|
out.push(`.${data.name}`);
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user