Updated ":has()"

garry-ut99 2024-10-27 18:04:29 +00:00
parent 19b2127cce
commit e41db654a2

@ -56,7 +56,12 @@ A change from the [commit message](https://github.com/gorhill/uBlock/commit/a71b
The `:has(arg)` operator is actually a planned pseudo-class in CSS4, but as of writing no browser supports it (was available in stable channel of Chromium 105+ based browsers after 30 August 2022). Instead of waiting for browser vendors to provide support, uBO provides support for `:has(arg)` as a procedural operator.
See also: [`:upward()` vs `:has()`](./Filter-Performance#upward-vs-has)
Updated: all major browsers now supports `:has()` natively, so native `:has()` should be more efficient than procedural `:has()` which needs Javascript code to function. When using `:has()` uBlock will automatically switch to native `:has()` if it's available in browser, if it's unavailable uBlock will fallback to a procedural `:has()`. Using `#?#` (instead of `##` for a procedural cosmetic filter will prevent uBO from trying to convert the filter into a declarative one.
See also:
- [Procedural `:has` applies to multiple selectors; native `:has` only applies to the last one](https://github.com/uBlockOrigin/uBlock-issues/issues/2480)
- [Nested procedural filtering into `:has()` did not work](https://github.com/uBlockOrigin/uBlock-issues/issues/2228)
- [`:upward()` vs `:has()`](./Filter-Performance#upward-vs-has)
***