1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-11-02 00:42:45 +01:00

Code review re. attribute serializer

Related issue:
- https://github.com/uBlockOrigin/uBlock-issues/issues/2300

Related commit:
- 7379bafb23
This commit is contained in:
Raymond Hill 2022-09-28 09:05:04 -04:00
parent 7379bafb23
commit fe4cfeba2e
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2

View File

@ -1579,12 +1579,12 @@ Parser.prototype.SelectorCompiler = class {
switch ( data.type ) { switch ( data.type ) {
case 'AttributeSelector': { case 'AttributeSelector': {
const name = data.name.name; const name = data.name.name;
if ( data.matcher === null ) {
out.push(`[${name}]`);
break;
}
const value = data.value.value || data.value.name; const value = data.value.value || data.value.name;
out.push( out.push(`[${name}${data.matcher}"${value}"]`);
data.matcher
? `[${name}${data.matcher}"${value}"]`
: `[${name}]`
);
break; break;
} }
case 'ClassSelector': case 'ClassSelector':