1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-07-08 12:57:57 +02:00

Trim end of class tokens in generic cosmetic filtering's surveyor

Related issue:
https://github.com/uBlockOrigin/uBlock-issues/issues/3257
This commit is contained in:
Raymond Hill 2024-05-28 18:42:06 -04:00
parent ce7806e3f1
commit 8ea1bac80b
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2
2 changed files with 6 additions and 2 deletions

View File

@ -89,8 +89,10 @@ const uBOL_classesFromNode = (node, out) => {
end = s.indexOf(' ', beg); end = s.indexOf(' ', beg);
if ( end === beg ) { continue; } if ( end === beg ) { continue; }
if ( end === -1 ) { end = len; } if ( end === -1 ) { end = len; }
out.push(hashFromStr(0x2E /* '.' */, s.slice(beg, end))); const token = s.slice(beg, end).trimEnd();
beg = end; beg = end;
if ( token.length === 0 ) { continue; }
out.push(hashFromStr(0x2E /* '.' */, token));
} }
}; };

View File

@ -1016,8 +1016,10 @@ vAPI.DOMFilterer = class {
end = s.indexOf(' ', beg); end = s.indexOf(' ', beg);
if ( end === beg ) { continue; } if ( end === beg ) { continue; }
if ( end === -1 ) { end = len; } if ( end === -1 ) { end = len; }
const hash = hashFromStr(0x2E /* '.' */, s.slice(beg, end)); const token = s.slice(beg, end).trimEnd();
beg = end; beg = end;
if ( token.length === 0 ) { continue; }
const hash = hashFromStr(0x2E /* '.' */, token);
if ( queriedHashes.has(hash) ) { continue; } if ( queriedHashes.has(hash) ) { continue; }
queriedHashes.add(hash); queriedHashes.add(hash);
out.push(hash); out.push(hash);