Skip to content

@eyeo/snippets v0.8.0

Ilaria Schinina requested to merge develop into main

Background / User story

This version introduces a new snippet hide-if-matches-xpath3 and its dependencies. It allows to use XPath 3.1 functionalities from the snippet. It can be used to tackle advanced circumvention cases.

Dependency changes

  • Name: @eyeo/snippets
  • Version: v0.8.0
  • Breaking changes: none
  • Other changes:
    • added a new snippet hide-if-matches-xpath3 and its tests.

New features

New snippet hide-if-matches-xpath3

In this version we added a new snippet hide-if-matches-xpath3 which improves upon hide-if-matches-xpath that uses XPath 1. This new snippet allows to use XPath 3.1 functionalities like matches(), array, map operations and other supported XPath 3.1 features.

Instructions

  • This snippet does not behave consistently across browsers. When targeting an element based on tag names (//div for example), a slightly different syntax is to be used as a workaround (//*[name()="div"]), for example:
#$#hide-if-matches-xpath3 //*[name()="div"] #$#hide-if-matches-xpath3 //div
  • 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.

Integration notes

For web extensions: hide-if-matches-xpath3 requires JS dependencies to run. This dependencies will be automatically added by using the existing mechanisms in the SDK. Please be aware that this file increases the size of the extension (background.js) by ~430kB.

For Chromium browsers: in order to use hide-if-matches-xpath3 you will need to actively opt-in and make some changes in the SDK. You can keep using isolated-first.jst if you don't want to include the new snippet. If you want to include the new snippet, you need to have the mechanism to inject its dependency (new dependencies.jst file). You would also need to change the artifact you use from isolated-first.jst to isolated-first-xpath3.jst.

Edited by Ilaria Schinina

Merge request reports