News for hackers. Stuff that matters.
Re:State of CSS by Semaphor on Friday October 21, 2022 @10:37AM (#33288425)
Actual nesting is on the way [0], but for now you can already use :is() [1] in many cases.

[0]: https://blog.openreplay.com/modern-css-selectors/

[1]: https://developer.mozilla.org/en-US/docs/Web/CSS/:is

Re:State of CSS by keb_ on Friday October 21, 2022 @11:42AM (#33289213)
That's awesome. Thank you for sharing.
Re:State of CSS by laundermaf on Friday October 21, 2022 @02:26PM (#33291377)
:is() exclusively reduces nesting if your nest produces a single rule, which is the least common situation and is generally dealt with by just duplicating the selector rather than nesting.
Re:State of CSS by runarberg on Friday October 21, 2022 @03:04PM (#33291837)
:is also has tighter specificity then a nested selector. which is a footgun for sure. However you can use :where instead, which is basically just :is without this footgun.
Re:State of CSS by clairity on Friday October 21, 2022 @05:12PM (#33293091)
there's a subtlety missing: :is() selects the highest specificity from the selector list while :where() sets specificity to 0 for anything in the selector list. this leaves out the (admittedly narrow) case where you want the lowest matching specificity (in case 2+ selectors match) rather than just 0, which is probably what most folks would expect, just as we would tend to expect selector lists to be forgiving (following the principle of least surprise).