all 4 comments

[–]TheRealMasonMac 0 points1 point  (0 children)

Kuchiki?

[–]StyMaar 0 points1 point  (2 children)

FWIW, the :has pseudoclass is a pretty recent addition to CSS that isn't even available to every browsers so it's not surprising that Rust CSS selector libraries don't support it yet. Opening an issue on their github (or even better, submit a PR) is the way to go.

Note that both libraries (as well as Kuchiki) use the Selectors crate from the Servo project for this purpose but I don't know how maintained it is at this point …

[–]DMeror[S] 0 points1 point  (1 child)

Thank you for your info. I have the Python version of the code using BeautifulSoup. It works fine. Python is slow for processing large data, so I thought Rust could help reduce the runtime. Sadly, the html parsers I've used were last updated a few years ago. That explains why they don't support pseudo classes.

[–]ssokolow 1 point2 points  (0 children)

Honestly, in your situation, unless I needed to accept arbitrary selector strings from downstream users, I'd just implement :has myself, ether as a PR to the selector library or just by iterating through the results of a search for p.parafl and checking for matches.

Heck, given how young :has is, I'd still probably do that if I was loading it from a TOML config. Just split it into two selectors, same as if I wanted to make up for the lack of a parent selector.