ExtendedCss icon indicating copy to clipboard operation
ExtendedCss copied to clipboard

Some rules with ':not(:has())' don't work correctly

Open AdamWr opened this issue 2 years ago • 7 comments

Related issue - https://github.com/AdguardTeam/AdguardFilters/issues/140279

Steps to reproduce:

  1. Add this rule:
example.org#?#div:not(:has(img, input, iframe, h1, p))
  1. Go to - https://example.org/

Website is blank, but it shouldn't be.

It looks like that ExtendedCss.query('div:not(:has(img, input, iframe, h1, p))') returns one div, but document.querySelectorAll('div:not(:has(img, input, iframe, h1, p))') returns empty NodeList.

Screenshot

image


By the way, it looks like that even if rule is added without ?, like this:

example.org##div:not(:has(img, input, iframe, h1, p))

then it's still treated as an Extended CSS rule, but I think it shouldn't be.

AdamWr avatar Jan 17 '23 08:01 AdamWr

Judging by overnight testing, I currently get the impression that AdGuard is in practice interpreting #?#div:not(:has(img, input, iframe, h1, p)) as #?#div:not(:has(img)), as a simple way to explain what is going on.

DandelionSprout avatar Jan 18 '23 02:01 DandelionSprout

Maybe it is time to back version compatible with Pale Moon and Basilisk.

krystian3w avatar Jan 19 '23 22:01 krystian3w

That would unfortunately have been pretty impractical for these kinds of entries, as it'd require something like #?#div:not(:has(img)):not(:has(input)):not(:has(iframe)):not(:has(h1)):not(:has(p))

DandelionSprout avatar Jan 20 '23 00:01 DandelionSprout

Another case:

This rule in Easylist Cookie list:

bloomberg.com##body:not(:has(div[class*="player" i][class*="_container"], #root .datastrip)) > div[id^="sp_message_container"]

Broke Bloomberg completely: https://www.bloomberg.com/news/articles/2023-04-27/electronic-arts-star-wars-jedi-survivor-was-made-in-record-time?leadSource=uverify+wall

The rule should target div[id^="sp_message_container"], not the body element.

peace2000 avatar May 02 '23 14:05 peace2000

Also simpler forms of the rule cause the breakage:

bloomberg.com##body:not(:has(div[class*="player" i][class*="_container"])) > div[id^="sp_message_container"]

bloomberg.com##body:not(:has(#root .datastrip)) > div[id^="sp_message_container"]

peace2000 avatar May 02 '23 14:05 peace2000

I think that the issue on bloomberg.com is rather a bit different and it's related to this - https://github.com/AdguardTeam/ExtendedCss/issues/166

AdamWr avatar May 02 '23 14:05 AdamWr

Ok, copied my comments there. But I'll leave them here as well just in case.

peace2000 avatar May 02 '23 15:05 peace2000