Skip to content

Allow `hideIfMatchesXPath` to reach non-elements

Background

One feature XPath has over CSS selectors, is that it can reach also text nodes, or any kind of node, within an element.

Currently, due to its hideElement usage, this possibility is taken away, but we should enable it to make this snippet even more powerful.

What to change

Use hideElement(element) only if element.nodeType === Node.ELEMENT_NODE, and remove the node otherwise.