AdguardTeam / ExtendedCss

A TypeScript library for non-standard element selecting — :contains(), :matches-css(), etc., and applying CSS styles with extended properties.
GNU General Public License v3.0
65 stars 9 forks source link

Add " and \ in regex ExtendedCss version of filters (uBO version only) #116

Closed slavaleleka closed 3 years ago

slavaleleka commented 3 years ago

@krystian3w commented on Tue Nov 24 2020

https://github.com/uBlockOrigin/uBlock-issues/issues/1359

uBO need this " and \, to property hide "+11 elements" based on AdGuard Base:

:matches-css(background-image: /^url\("data/) :matches-css(background-image: /^url\(data/)
supported by uBO not supported by uBO
:matches-css(background-image: /^url\("http/) :matches-css(background-image: /^url\(http/)
supported by uBO not supported by uBO

after correction:

pogoda.wp.pl#?#.grid-container > .grid-left > .list > ul > li > div[class*=" "]:matches-css(background-image: /^url\("data:image/png;base64,iVBOR/):has(> div:first-child)
pogoda.wp.pl#?#.grid-container > .grid-right div[class*=" "]:matches-css(background-image: /^url\("data:image/png;base64,iVBOR/):has(> div:first-child)

money.pl#?##app > div[class^="sc-"] > div[class*=" "]:matches-css(background-image: /^url\("https:\/\/v\.wpimg\.pl\//)

portal.abczdrowie.pl#?#.article__container > .content-aside .content-aside__item:matches-css(background-image: /^url\("https:\/\/portal\.abczdrowie\.pl\/media\/images\/commb\.png/)
zywienie.abczdrowie.pl#?#.article__container > .content-aside .content-aside__item:matches-css(background-image: /^url\("https:\/\/zywienie\.abczdrowie\.pl\/media\/images\/commb\.png/)

zywienie.abczdrowie.pl#?#.article__textbox:matches-css(background-image: /^url\("https:\/\/zywienie\.abczdrowie\.pl\/media\/images\/commb\.png/)

pogoda.wp.pl#?##__layout > div[class] > div[class*= " "]:matches-css(background-image: /^url\("data:image/png;base64,iVBOR/):has(> div:only-child:empty)
pogoda.wp.pl#?#.grid-container > div[class*=" "]:matches-css(background-image: /^url\("data:image/png;base64,iVBOR/):has(> div:only-child:empty)
pogoda.wp.pl#?#.grid-container > div[class^="grid-"] > div[class*=" "]:matches-css(background-image: /^url\("data:image/png;base64,iVBOR/):has(> div:only-child:empty)
pogoda.wp.pl#?#.grid-container > div[class^="grid-"] > div[class] > div[class*=" "]:matches-css(background-image: /^url\("data:image/png;base64,iVBOR/):has(> div:only-child:empty)
pogoda.wp.pl#?#.grid-container > div[class^="grid-"] > .list > ul > li > div[class*=" "]:matches-css(background-image: /^url\("data:image/png;base64,iVBOR/):has(> div:only-child:empty)

for now I can not found more glitched due extended-css-selector.js in AdGuard projects.


@ameshkov commented on Tue Nov 24 2020

@slavaleleka take a look, please.

slavaleleka commented 3 years ago

we have been removing quotes for background-image url while matching the element

but since there is no such restriction anymore (there are quoted in Safari, Chrome and Firefox) and due to uBO needs, we shall not remove the quotes + add support for rules with or without them (for non-regex pattern)

so for non-regex pattern we should use quotes in AdGuard filters lists in order to such rules supporting by uBO