hide-if-matches-xpath3

hide-if-matches-xpath3

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

Requires Browser Ad-Filtering Solution version 117+ with Snippet library version 0.8.1+.
Use only when hide-if-matches-xpath is not sufficient, as it is slower and not backward compatible.

Parameters

Name

Description

Mandatory

query

The XPath query that targets the element to hide.

Yes

scopeQuery

XPath selector to restrict the scope of the Mutation Observer.

No

Filter examples

Filter

Result

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

Hides all elements with id="sponsored".

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

Hides elements containing "sponsored" regardless of case.

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

Hides divs with a class matching the regex.

Other resources