At this point I'm happily re-concluding the conclusion arrived at in Appendix 1, CSS Selector Performance - that CSS selectors are rarely a problem with static pages. Plus, attempting to second guess which selector will perform well is probably futile.
However, for large DOMs and dynamic DOMs (e.g. not the odd class toggle, we are talking lots of JavaScript manipulation) it may not be beyond the realms of possibility that CSS selectors could be causing an issue. I can't speak for all of Mozilla, but I think when you're dealing with performance, you want to focus on what's slow. Sometimes that will be selectors; usually it will be other things, says L. David Baron (http://dbaron.org/), of Mozilla (https://www.mozilla.org/en-US/) and a member of the W3C's CSS working group. I’ve definitely seen pages where selector performance matters, and I've definitely seen lots of pages where it doesn't.
So what should we do? What's the most pragmatic approach?
You should use profiling tools to determine where your performance problems are, and then work on solving those problems | ||
--Baron |
Everyone I spoke to echoed these sentiments.