1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-07-01 02:02:29 +02:00

:upward()

gwarser 2020-03-07 23:05:16 +01:00
parent 34046f3b57
commit 7b0e09b00a

@ -124,8 +124,9 @@ Note that if _arg_ is valid CSS selector, uBO will not consider the `:not` opera
### `subject:nth-ancestor(n)`
- Description: lookup the nth ancestor relative to the currently selected
node.
Deprecated in favor of [`subject:upward(arg)`](#subjectupwardarg) in [1.25.3b0](https://github.com/gorhill/uBlock/commit/72bb70056843024b1a31fe1ab9c90bd4e8260ba2)
- Description: lookup the nth ancestor relative to the currently selected node.
- Chainable: Yes.
- _subject_: Can be a plain CSS selector, or a procedural cosmetic filter.
- _n_: positive number >= 1 and < 256, distance from the currently selected node.
@ -136,6 +137,23 @@ Introduced in uBO [1.18.17rc1](https://github.com/gorhill/uBlock/commit/73e2f25e
***
### `subject:upward(arg)`
- Description: lookup the ancestor relative to the currently selected node.
- Chainable: Yes.
- _subject_: Can be a plain CSS selector, or a procedural cosmetic filter.
- _arg_:
- Positive number >= 1 and < 256, distance from the currently selected node.
- A valid plain CSS selector.
- Examples:
- Existing filter: `fastbay.org##.detLink:has-text(VPN):xpath(../../..)` can be rewritten as `fastbay.org##.detLink:has-text(VPN):upward(3)`
Introduced in uBO [1.25.3b0](https://github.com/gorhill/uBlock/commit/72bb70056843024b1a31fe1ab9c90bd4e8260ba2). Evolution of [`:nth-ancestor(n)`](#subjectnth-ancestorn) selector.
See also [`Element.closest()` ↪](https://developer.mozilla.org/en-US/docs/Web/API/Element/closest)
***
### `subject:watch-attrs(arg)`
Deprecated in favor of [`subject:watch-attr(arg)`](#subjectwatch-attrarg) in [1.20.1b3](https://github.com/gorhill/uBlock/commit/41685f4cce084f3f89e9cdd8fc1cde5b57862958)