From c3d0d574d7eb68c4a2f7738e1b1911905859dedf Mon Sep 17 00:00:00 2001 From: Raymond Hill Date: Fri, 4 Nov 2022 10:55:10 -0400 Subject: [PATCH] Fix incorrect serialization of pseudo elements Related feedback: - https://www.reddit.com/r/uBlockOrigin/comments/ylnvwf/how_to_block_suggestive_keyword_in_reddit_search/iv014wu/ --- src/js/static-filtering-parser.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/js/static-filtering-parser.js b/src/js/static-filtering-parser.js index 3bd8316bd..d89190abf 100644 --- a/src/js/static-filtering-parser.js +++ b/src/js/static-filtering-parser.js @@ -1636,7 +1636,8 @@ Parser.prototype.SelectorCompiler = class { } case 'PseudoClassSelector': case 'PseudoElementSelector': - out.push(`:${data.name}`); + out.push(data.type === 'PseudoClassSelector' ? ':' : '::'); + out.push(data.name); if ( Array.isArray(part.args) ) { const arg = this.astSerialize(part.args); if ( typeof arg !== 'string' ) { return; } @@ -1656,7 +1657,6 @@ Parser.prototype.SelectorCompiler = class { return out.join(''); } - astSerialize(parts, plainCSS = true) { const out = []; for ( const part of parts ) {