hide-if-matches-xpath3

The hide-if-matches-xpath3 hides a specific element through a XPath 3.1 query string.

hide-if-matches-xpath3 requires Browser Ad-Filtering Solution version 117+ with Snippet library version 0.8.1+.

hide-if-matches-xpath3 should be used only when hide-if-matches-xpath is not enough for your use case, because it is slower and, at this point in time, not backward compatible with hide-if-matches-xpath.

Parameters

NameDescriptionMandatory

query

The XPath query that targets the element to hide.

Yes

scopeQuery

CSS or XPath selector that the filter devs can use to restrict the scope of the Mutation Observer. It is important that the selector is as specific as possible to avoid to match too many nodes.

No

Filter examples

The following table lists examples that use the hide-if-matches-xpath3 snippet:

FilterResult

hide-if-matches-xpath3 '//*[@id="sponsored"]'

Hides all elements withid="sponsored".

hide-if-matches-xpath3 '//*[lower-case(text())="sponsored"]'

Hides any element that contains the text "sponsored" in its text content, regardless of the element type or the case (upper or lower) of the text (e.g.: "sPoNSoReD").

hide-if-matches-xpath3 '//div and matches(@class,"Spon(.+)sored")]'

Hides all divs with a class containing a value that matches the regular expression pattern "Spon(.+)sored" (e.g.: "Spon12345sored").

Other resources

Last updated