4 ms·
> 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"] ins
by smilekzs 1y ago
> 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?
- robin_reala 1y agoGiven the morass of JS slathered on every site these days, selector performance is the least of your worries.
- nolanl 1y agoAuthor here. I actually did some research on CSS selector performance: https://nolanlawson.com/2023/01/17/my-talk-on-css-runtime-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/selector-stats https://developer.chrome.com/docs/devtools/performance/selec...