News for hackers. Stuff that matters.
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).