Comment by smilekzs

Comment by smilekzs 19 hours ago

2 replies

> The active class is clearly redundant here. If you want to style based on the .active selector, you could just as easily style with [aria-selected="true"] instead.

I vaguely remember (from 10+ years ago) that class selectors are much more performant than property selectors?

nolanl 11 hours ago

Author here. I actually did some research on CSS selector performance: https://nolanlawson.com/2023/01/17/my-talk-on-css-runtime-pe...

The TL;DW is: yes, class selectors are slightly more performant than attribute selectors, mostly because only the attribute _names_ are indexed, not the values. But 99% of the time, it's not a big enough deal to justify the premature optimization. I'd recommend measuring your selector performance first: https://developer.chrome.com/docs/devtools/performance/selec...

robin_reala 18 hours ago

Given the morass of JS slathered on every site these days, selector performance is the least of your worries.