Skip to content

Commit 750b371

Browse files
authored
AG-27455 update the :has() pseudo-class section
AdguardTeam/AdguardBrowserExtension#2587
2 parents 1757240 + a63cbce commit 750b371

1 file changed

Lines changed: 16 additions & 7 deletions

File tree

docs/general/ad-filtering/create-own-filters.md

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3595,22 +3595,31 @@ Draft CSS 4.0 specification describes the [`:has()` pseudo-class](https://www.w3
35953595
35963596
Rules with the `:has()` pseudo-class must use the [native implementation of `:has()`][native-has]
35973597
if they use the `##` rule marker and if it is possible, i.e., there are no other extended CSS selectors inside.
3598-
If it is not supported by the product, ExtendedCss implementation will be used even for rules with the `##` marker.
3598+
If it is not supported by the product (or by the browser in case of AdGuard Browser Extension),
3599+
ExtendedCss implementation will be used automatically as a fallback,
3600+
even for rules with the `##` marker.
35993601
3600-
Currently, not all AdGuard products support the native implementation of `:has()` yet:
3602+
AdGuard products support the native implementation of `:has()`:
36013603
3602-
- AdGuard for Windows, AdGuard for Mac, AdGuard for Android, and AdGuard for Linux **do support** it with [CoreLibs] v1.12 or later.
3603-
- AdGuard for iOS and AdGuard for Safari **do support** it with [SafariConverterLib](#safari-converter-lib) v2.0.39 and [Safari browser v16.4][safari-16.4].
3604-
- AdGuard Browser Extension **does not support** it yet, but it is [planned][AdguardBrowserExtension#2587].
3604+
- AdGuard for Windows, AdGuard for Mac, AdGuard for Android, and AdGuard for Linux **support** it with [CoreLibs] v1.12 or later.
3605+
- AdGuard for iOS and AdGuard for Safari **support** it with [SafariConverterLib](#safari-converter-lib) v2.0.39 and [Safari browser v16.4][safari-16.4] or later.
3606+
- AdGuard Browser Extension **supports** it in v5.3 or later:
3607+
- **Manifest V3** (Chromium-based): always uses native `:has()` by default.
3608+
- **Manifest V2**: Detects native `:has()` support using `CSS.supports()` and falls back to ExtendedCss if the browser doesn’t support it natively.
3609+
- All other AdGuard products **do not support** it.
36053610
3606-
To force the ExtendedCss implementation of `:has()` to be used, use the `#?#` or `#$?#` rule markers explicitly,
3611+
To force the ExtendedCss implementation of `:has()` to be used (regardless of native support),
3612+
use the `#?#` or `#$?#` rule markers explicitly,
36073613
e.g., `example.com#?#p:has(> a)` or `example.com#$?#div:has(> span) { display: none !important; }`.
36083614
3615+
And since the `:has()` pseudo-class cannot be nested within another `:has()`
3616+
in native implementation, e.g. `div:has(p:has(a))`,
3617+
it is always treated as extended in AdGuard Browser Extension.
3618+
36093619
:::
36103620
36113621
[native-has]: https://developer.mozilla.org/docs/Web/CSS/:has
36123622
[safari-16.4]: https://www.webkit.org/blog/13966/webkit-features-in-safari-16-4/
3613-
[AdguardBrowserExtension#2587]: https://github.com/AdguardTeam/AdguardBrowserExtension/issues/2587
36143623
36153624
**Compatibility with other pseudo-classes**
36163625

0 commit comments

Comments
 (0)