From 7e5af9ed1b8978c5139e29ab7327fc45ecf6ff85 Mon Sep 17 00:00:00 2001 From: Raymond Hill Date: Thu, 15 Dec 2022 12:39:29 -0500 Subject: [PATCH] Move `matches-attr` to respect alphabetical order --- Procedural-cosmetic-filters.md | 52 +++++++++++++++++----------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/Procedural-cosmetic-filters.md b/Procedural-cosmetic-filters.md index c821bd0..d3a3e7a 100644 --- a/Procedural-cosmetic-filters.md +++ b/Procedural-cosmetic-filters.md @@ -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.