Skip to content

Releases: AdguardTeam/ExtendedCss

1.0.10

21 Mar 09:14
Compare
Choose a tag to compare
  • [Added] :if and :if-not pseudo-classes support: #51
  • [Added] :properties pseudo-class support: #56
  • [Fixed] Protection from infinite loops while changing a protected element: #62
  • [Fixed] Improved extended rules performance: #55
  • [Fixed] Incorrect parsing of styles: #57

IMPORTANT: ExtendedCss constructor now has two arguments. The new one is propertyFilterIgnoreStyleNodes - a list of stylesheet nodes that should be ignored by the StyleObserver (an object that implements the :properties pseudo-class ). It is crucial to pass a list of custom stylesheets to the constructor.

README is updated with the detailed description of the ExtendedCss pseudo-classes:
https://github.com/AdguardTeam/ExtendedCss/blob/master/README.md

1.0.9

04 Dec 08:58
Compare
Choose a tag to compare

[Fixed] ExtendedCss does not match elements on certain circumstances when sibling combinators and descendant combinators are mixed

There was a bug in ExtendedCss caused certain extended selectors which combined sibling combinators and descendant combinators to determine matching elements as non-matching. This release fixes the bug.

1.0.8

12 Jul 13:31
Compare
Choose a tag to compare

[Improved] Support :-abp-*() syntax #30

ABP recently decided..

  • ..to use syntax :-abp-has() syntax and not use the backward-compatible syntax [-abp-has="..."]. As such, we drop the support for ABP's backward-compatible syntax and add support for :-abp-has.
  • ..to use syntax :-abp-contains() instead of :-abp-has-text(). As such , we drop the support for -abp-has-text and add support for :-abp-contains.

1.0.7

07 Jul 12:32
Compare
Choose a tag to compare

[Fixed] Some matches-css rules are not applied #23

There was a bug that ExtendedCss could not parse a selector with many :matches-css pseudo classes or with complicated arguments inside :matches-css.
It was necessary to impose some rules in order to make extended selectors declarative.

The allowed arguments will be outlined below.

[Improved] Support regular expressions as arguments of :contains and :matches-css #29

ExtendedCss now support regular expressions as arguments of :contains and :matches-css. Same for :has-text, :matches-css-after, :matches-css-before.
Previously, arguments of such are treated as a substring of a text to be matched against, and additionally for :matches-css, we supported ABP-style special characters used in url matching filter rules, such as |,^,*. Now, if arguments are enclosed in / symbols, it will be treated as a regular expression which matches the same text as the JS regular expression.

:contains, :has-text

  1. Unquoted texts, with characters ()[] escaped.
    • Sizzle automatically removes escapes.
    • The resulting argument will be tested against textContent that it contains the argument.
    • Example: .placeholder:contains(googletag.cmd.push\(function\(\){))
  2. Regular expressions, enclosed by / on both sides.
    • It should represent a valid JavaScript regular expression object.
    • As such, characters / should be escaped in the regular expression text.
    • Example: .block:has(> .header:contains(/[Ss]ponsored/))
  • Below is kept here for reference, but is discouraged to use it.
  1. Quoted texts, either by " or '.
    • Sizzle automatically correct escaped " and ', and the resulting string will be searched against textContent.
    • Note that this may not work with other adblockers which support similar syntaxes.
  2. Unquoted texts containing unescaped()[]
    • Sizzle supports this, but its behavior is unpredictable, so it is not recommended to use it.

:matches-css, :matches-css-after, :matches-css-before

Allowed arguments are similar to those of :contains.

  1. Unquoted texts, with characters ()[] not occurring at all or are all escaped.
    • Example: div[class^="_"]:matches-css(background-color: rgb\(255, 0, 0\))
  2. Regular expressions of a form :matches-css( propertyName: /.*/ )
    • Example: div[class^="_"]:matches-css(background-image: /url\(data\:image\/png;base64,[\w\d\/+=]{100,}\)/ )
  • Below is kept here for reference, but is discouraged to use it.
  1. Quoted texts, either by " or '.
    • The string occurring after the style property name will be used as an ABP url matching rule for matching elements' style property value.
  2. Unquoted texts containing ()[]
    • It may happen to be working for some cases, but it can cause erratic behavior as in #23 (comment).

[Improved] Remove unsupported pseudo class declarations #26

[Improved] Observe document.documentElement instead of document.body to subscribe to parser-generated mutation events #28

[Fixed] Compatibility with old versions Internet Explorer#35

[Fixed] Extended css test fails if opened in new tab #41

[Improved] Use Travis-CI to automate unit-testing #38