Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Excited to finally have a parent selector, but this feels like a major footgun that will promote brittle DOM specific CSS.


:has() sounds amazing on the surface. I’d be interested in a good advantages / disadvantages overview if anyone :has() a link.

Edit: Useful: https://caniuse.com/?search=has


there are a bunch of good articles out there on :has() now, like this one: https://www.smashingmagazine.com/2021/06/has-native-css-pare...

i've been experimenting with it on safari tech preview, and it really lets you do many things that were previously impossible or unacceptably brittle. i love it.

same with container queries. have been experimenting, it's really nice compared to page grids and breakpoint hell.


Ohhh, I didn't know that container queries are finally being implemented. I'd given up on them as something that would be great but didn't look like they were going to happen.


it's extremely useful for defining ublock origin rules


So far I've only used it in TamperMonkey. Between your comment and culturestate's[0], you may be on to something.

[0] https://news.ycombinator.com/item?id=31369223


> this feels like a major footgun that will promote brittle DOM specific CSS

I can’t say I’ve really considered this in any depth, but my very first thought when I saw :has() was “finally, I can fix those last stupid bugs in my HN userstyle.”

So…you may be on to something.




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: