From 30bd6c7bb8d5487b42b9455d50655ea9a4118063 Mon Sep 17 00:00:00 2001 From: Raymond Hill Date: Fri, 14 Oct 2022 13:04:47 -0400 Subject: [PATCH] Parse -abp-has as declarative if possible With the new csstree-based parser, it should now be safe to parse `-abp-has` as declarative. There are over a hundred such cosmetic filters in EasyList, and we want to have these filters declaratively enforced whenever possible in order to let the browser do the work natively rather than rely on JS code. --- .../scriptlets/{css-specific-procedural.js => css-procedural.js} | 0 src/js/static-filtering-parser.js | 1 + 2 files changed, 1 insertion(+) rename platform/mv3/scriptlets/{css-specific-procedural.js => css-procedural.js} (100%) diff --git a/platform/mv3/scriptlets/css-specific-procedural.js b/platform/mv3/scriptlets/css-procedural.js similarity index 100% rename from platform/mv3/scriptlets/css-specific-procedural.js rename to platform/mv3/scriptlets/css-procedural.js diff --git a/src/js/static-filtering-parser.js b/src/js/static-filtering-parser.js index 3da7f0442..04b904444 100644 --- a/src/js/static-filtering-parser.js +++ b/src/js/static-filtering-parser.js @@ -1425,6 +1425,7 @@ Parser.prototype.SelectorCompiler = class { if ( match === ':-abp-contains(' ) { return ':has-text('; } else if ( match === ':-abp-has(' ) { + this.asProcedural = false; return ':has('; } return match;