:others()

gwarser 2022-09-12 21:32:40 +02:00
parent 54c43b1679
commit 2e082a5fbc
1 changed files with 27 additions and 2 deletions

@ -24,8 +24,6 @@ _Procedural_ means JavaScript code will find DOM elements that it must hide. A p
### `subject:has(arg)` ### `subject:has(arg)`
<sub>Semantic changed in uBO 1.15.0 to resemble `:if(...)`</sub>
- Description: Select element _subject_ if and only if evaluating _arg_ in the context of _subject_ returns one or more elements. - Description: Select element _subject_ if and only if evaluating _arg_ in the context of _subject_ returns one or more elements.
- Chainable: Yes. - Chainable: Yes.
- _subject_: Can be a plain CSS selector, or a procedural cosmetic filter. - _subject_: Can be a plain CSS selector, or a procedural cosmetic filter.
@ -130,6 +128,33 @@ Note that if _arg_ is valid CSS selector, uBO will not consider the `:not` opera
*** ***
### `subject:others()`
Experimental.
- Description: Target all elements _outside_ than the currently selected set of elements.
- Chainable: Yes.
- _subject_: Can be a plain CSS selector, or a procedural cosmetic filter.
- Examples:
- `twitter.com##:matches-path(/^/home/) [data-testid="primaryColumn"]:others()`
- `nature.com##:matches-path(/^/articles//) :is(.c-breadcrumbs,.c-article-main-column):others()`
Introduced in uBO [1.41.1b2](https://github.com/gorhill/uBlock/commit/152120bd9ec7a2ccea907e015fb195484ef7bc8e)
For any element feeding into `others()`, the resultset of the `others()` operator will include everything else except:
- the descendants of a subject element
- the ancestors of a subject element
The resultset will contains the siblings of a subject element _except_ when those siblings are either a descendant or ancestor of another subject element.
Though this operator is unlikely to be used in default lists, it opens the door to create specialized filter lists which purpose is some sort of "reader mode", where everything _else_ than a selected set of elements are hidden from view.
Related discussion:
- https://www.reddit.com/r/uBlockOrigin/comments/slyjzp/
***
### `subject:upward(arg)` ### `subject:upward(arg)`
- Description: lookup the ancestor relative to the currently selected node. - Description: lookup the ancestor relative to the currently selected node.