From c5724c1ccec0e680916504deacd993a2d392fa6d Mon Sep 17 00:00:00 2001 From: Raymond Hill Date: Mon, 20 Nov 2023 19:38:18 -0500 Subject: [PATCH] Enable path for native `has()` selector in Firefox Reference: https://bugzilla.mozilla.org/show_bug.cgi?id=1858743 --- platform/common/vapi-common.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/platform/common/vapi-common.js b/platform/common/vapi-common.js index 8c46dbef2..b7c38533e 100644 --- a/platform/common/vapi-common.js +++ b/platform/common/vapi-common.js @@ -155,6 +155,9 @@ vAPI.webextFlavor = { } }; +// https://bugzilla.mozilla.org/show_bug.cgi?id=1858743 +// Add support for native `:has()` for Firefox 121+ + (( ) => { const ua = navigator.userAgent; const flavor = vAPI.webextFlavor; @@ -184,13 +187,16 @@ vAPI.webextFlavor = { flavor.major = parseInt(info.version, 10) || flavor.major; soup.add(info.vendor.toLowerCase()) .add(info.name.toLowerCase()); + if ( flavor.major >= 121 && soup.has('mobile') === false ) { + soup.add('native_css_has'); + } dispatch(); }); if ( browser.runtime.getURL('').startsWith('moz-extension://') ) { soup.add('firefox') .add('user_stylesheet') .add('html_filtering'); - flavor.major = 91; + flavor.major = 115; } return; }