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

Remake :upward() after Sizzle replacement #111

Closed
slavaleleka opened this issue Aug 7, 2020 · 6 comments
Closed

Remake :upward() after Sizzle replacement #111

slavaleleka opened this issue Aug 7, 2020 · 6 comments

Comments

@slavaleleka
Copy link
Contributor

Limited to work properly only at the end of selector, except of pseudo-class :remove().

What is the reason of this limitation?
I mean that in third party filters there are few rules like this #?#selector:upward(1) + anotherSelector, so these rules will not work.

For example in Swedish filter:

tidningen.nu##span:has-text(/^Annons$/):upward(1) + .textwidget
viafree.se##.vjs-playing:upward(1) ~ .no-autoplay-overlay

https://github.com/AdguardTeam/FiltersRegistry/blob/6cce7c92672856220f256e85a26a2494196e35c3/filters/ThirdParty/filter_243_FrellwitSwedish/diff.txt#L200

Originally posted by @AdamWr in #102 (comment)

@slavaleleka slavaleleka changed the title Remake :remove() Remake :remove() after Sizzle replacement Aug 7, 2020
@slavaleleka slavaleleka added this to the 2.0 milestone Aug 7, 2020
@slavaleleka slavaleleka self-assigned this Aug 7, 2020
@slavaleleka slavaleleka changed the title Remake :remove() after Sizzle replacement Remake :upward() after Sizzle replacement Aug 11, 2020
@ameshkov ameshkov mentioned this issue Aug 11, 2020
6 tasks
@slavaleleka
Copy link
Contributor Author

merged into #110

@krystian3w
Copy link

krystian3w commented Aug 14, 2020

I have another one idea with upward:

mail.yahoo.com#?#div[data-test-id="efv-subheader"]:has(:upward(1) ~ div[data-test-id="video-container"])

and this is needed for AdGuard only:

mail.yahoo.com#?#div[data-test-id="efv-header"]:has(~ div[data-test-id="video-container"]) > div[data-test-id="efv-subheader"]

@Yuki2718
Copy link

It's hard for a layman like me to understand why supporting :upward is so hard when AG already supports :nth-ancestor.

@krystian3w
Copy link

Sizzle block use in other place as end in filter.

@ameshkov ameshkov removed this from the 2.0 milestone Aug 21, 2020
@ameshkov
Copy link
Member

Pseudo-classes like :nth-ancestor, :remove and :xpath break the semantics of CSS selectors and that's why they are not compatible with a general-purpose CSS selectors engine we're using (Sizzle). We implement them using some rather ugly workarounds, but the only real solution would be to get rid of Sizzle and implement the parts we need by ourselves.

@Yuki2718
Copy link

@ameshkov Thx for clarification!

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

No branches or pull requests

5 participants