mirror of
https://github.com/gorhill/uBlock.git
synced 2026-03-11 09:04:36 +00:00
Updated Procedural cosmetic filters (markdown)
parent
bfecfbefbf
commit
c7f5cd7e93
1 changed files with 11 additions and 3 deletions
|
|
@ -8,13 +8,21 @@ _Procedural_ means javascript code is used to find DOM elements which must be hi
|
|||
|
||||
### `subject:has(arg)`
|
||||
|
||||
- Description: Select element `subject` if and only if evaluating `arg` in the context of `subject` returns one or more elements.
|
||||
- Subject `subject`: **must** be a plain CSS selector.
|
||||
- Argument `arg`: **must** be a plain CSS selector.
|
||||
- Description: Select element _subject_ if and only if evaluating _arg_ in the context of _subject_ returns one or more elements.
|
||||
- _subject_: **must** be a plain CSS selector.
|
||||
- _arg_: **must** be a plain CSS selector.
|
||||
- Examples:
|
||||
- `strikeout.me##body > div:has(img[alt="AdBlock Alert"])`
|
||||
- `yandex.ru##.serp-item:has(:scope > .organic > .organic__subtitle > .label_color_yellow)`
|
||||
|
||||
The `:has(arg)` operator is actually a planned pseudo-class in CSS4, but as of writing no browser supports it. Instead of waiting for browser vendors to provide support, uBO provides support for `:has(arg)` as a procedural operator. By restricting `subject` and `arg` to be valid CSS selectors, this means uBO will be able to support the `:has(...)` operator declaratively once a browser supports it.
|
||||
|
||||
### `subject:has-text(needle)`
|
||||
|
||||
- Description: Select element _subject_ if and only if the text _needle_ is found inside the element _subject_.
|
||||
- Chainable: Yes.
|
||||
- _subject_: Can be a plain CSS selector, or a procedural cosmetic filter (i.e. chainable).
|
||||
- _needle_: The literal text which must be found, or a literal regular expression.
|
||||
- Examples:
|
||||
- `example.com##body > div:last-of-type span:has-text(/^Promoted by/)`
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue