Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
AdamWr opened this issue Jan 17, 2023 · 7 comments
Open

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

AdamWr opened this issue Jan 17, 2023 · 7 comments
Assignees

Comments

@AdamWr
Copy link
Member

AdamWr commented Jan 17, 2023

Related issue - AdguardTeam/AdguardFilters#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.

@DandelionSprout
Copy link
Member

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.

@krystian3w
Copy link

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

@DandelionSprout
Copy link
Member

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))

@adguard-bot adguard-bot assigned slavaleleka and unassigned zzebrum Jan 27, 2023
@adguard-bot adguard-bot changed the title Some rules with :not(:has()) don't work correctly Some rules with ':not(:has())' don't work correctly Jan 27, 2023
@peace2000
Copy link

peace2000 commented May 2, 2023

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
Copy link

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"]

@AdamWr
Copy link
Member Author

AdamWr commented May 2, 2023

I think that the issue on bloomberg.com is rather a bit different and it's related to this - #166

@peace2000
Copy link

peace2000 commented May 2, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants