3 ms·
Wish this article dedicated time to considering whether widespread use of attribute selectors will slow down the browser, but it doesn't seem to. CSS class sele
by kevingadd 4y ago
Wish this article dedicated time to considering whether widespread use of attribute selectors will slow down the browser, but it doesn't seem to. CSS class selectors have been aggressively optimized by browser vendors for decades, vs. selectors that just filter on an arbitrary set of HTML attributes.
Modern devices are pretty fast though, so maybe it's not an issue - but I know in the past the cost of doing CSS rule evaluation has been a problem.
- Keithamus 4y agoI considered exploring it but css selector performance just doesn’t matter with todays engines. There are far greater issues, and far better performance wins than “optimising your selectors”.
- kevingadd 4y agoMakes sense, I would just worry that if I built my whole stack around this, suddenly I hit a breakdown point where I have a ton of attribute selectors and now adding new DOM elements to a content view takes a millisecond. I'm more wary about this than I used to be since someone managed to accidentally cause tsc to need multiple seconds to compile a single file by making a small change to a type definition. Big O still can bite you!
- kemiller2002 4y agoWe use this approach, and I've wondered the same thing. The only evidence I found where it's slow is in old versions of IE. Haven't tested it myself except anecdotally, but we've had no problems with them.