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

Move matches-attr to respect alphabetical order

Raymond Hill 2022-12-15 12:39:29 -05:00
parent bf275bebbe
commit 7e5af9ed1b

@ -70,6 +70,32 @@ empty string by just quoting the empty string ([new in 1.45.3b10](https://github
***
### `subject:matches-attr(arg)`
- Description: Allows to select an element by its attributes, especially if they are randomized.
- Chainable: Yes.
- _subject_: Can be a plain CSS selector, or a procedural cosmetic filter.
- _arg_: A declaration in the form `name="value"` or `"name"="value"`, where `name` is attribute name and `value` is attribute value (optional), `name` and `value` can be literal text or literal regular expression.
Introduced in uBO [1.45.3b10](https://github.com/gorhill/uBlock/commit/76d70102f069856bffac7cd27dc40500c3bb9563)
Solves [uBlockOrigin/uBlock-issues#2329 (comment)](https://github.com/uBlockOrigin/uBlock-issues/issues/2329#issue-1412857923) (randomly generated attributes).
The supported syntax is exactly as per AdGuard's documentation:
- https://kb.adguard.com/en/general/how-to-create-your-own-ad-filters#extended-css-matches-attr
Though recommended, the quotes are not mandatory in uBO if
the argument does not cause the parser to fail and if there
are no ambiguities.
- Examples:
- `k-rauta.fi##button:matches-attr(class="/[\w]{7}/")`
- `k-rauta.fi##button:matches-attr("class"="/[\w]{7}/")`
on `https://www.k-rauta.fi/tuote/valmistasoite-hole-in-1-250ml/6408070100905`
***
### `subject:matches-css(arg)`
- Description: Select element _subject_ if and only if the result of evaluating _arg_ is one or more elements.
@ -226,32 +252,6 @@ By default hiding by procedural filters is reevaluated only when nodes in sub-tr
***
### `subject:matches-attr(arg)`
- Description: Allows to select an element by its attributes, especially if they are randomized.
- Chainable: Yes.
- _subject_: Can be a plain CSS selector, or a procedural cosmetic filter.
- _arg_: A declaration in the form `name="value"` or `"name"="value"`, where `name` is attribute name and `value` is attribute value (optional), `name` and `value` can be literal text or literal regular expression.
Introduced in uBO [1.45.3b10](https://github.com/gorhill/uBlock/commit/76d70102f069856bffac7cd27dc40500c3bb9563)
Solves [uBlockOrigin/uBlock-issues#2329 (comment)](https://github.com/uBlockOrigin/uBlock-issues/issues/2329#issue-1412857923) (randomly generated attributes).
The supported syntax is exactly as per AdGuard's documentation:
- https://kb.adguard.com/en/general/how-to-create-your-own-ad-filters#extended-css-matches-attr
Though recommended, the quotes are not mandatory in uBO if
the argument does not cause the parser to fail and if there
are no ambiguities.
- Examples:
- `k-rauta.fi##button:matches-attr(class="/[\w]{7}/")`
- `k-rauta.fi##button:matches-attr("class"="/[\w]{7}/")`
on `https://www.k-rauta.fi/tuote/valmistasoite-hole-in-1-250ml/6408070100905`
***
### `subject:xpath(arg)`
- Description: Create a new set of elements by evaluating an [XPath expression](https://developer.mozilla.org/en-US/docs/Web/XPath) using _subject_ as the context node (optional) and _arg_ as the expression.