CSS property matching improvements · 2016-11-14 13:05 by Felix Dahlke

About a year ago, we introduced CSS property filters as a means of hiding elements based on their styles. Today, we have landed two improvements to this:

Case insensitive matching

This is a change in semantics; CSS properties will now always be matched in a case insensitive manner, to make it consistent with the way Adblock Plus matches URLs. This is unlikely to result in undesired behaviour as there shouldn’t be many use cases for case sensitive property matching.

Regular expression matching

Until now, CSS properties could only be matched using the simple URL matching syntax, which made it difficult to match property values in a fine-grained manner. To address this, properties can now optionally be matched using regular expressions. The default matching behaviour is still the same, to use regular expressions, a matching expression needs to start and end with /, for example:

example.com##[-abp-properties='/width: 3[2-8]px;/']

These improvements are available in Adblock Plus for Firefox as of 2.8.1.4229 and Adblock Plus for Chrome and Opera as of 1.12.4.1682, and will presumably be released with the next stable version on each platform respectively.

Please note that we still consider CSS property filters an experimental feature, and therefore subject to change. Considering this, and the fact that CSS property filters are slower than regular element hiding rules, they should only be used as a last resort.

To the install page

Tags:

Comment

Commenting is closed for this article.