learn.jquery.com icon indicating copy to clipboard operation
learn.jquery.com copied to clipboard

Selector Performance

Open ajpiano opened this issue 13 years ago • 1 comments

Much has been written and discussed over the years with respect to selector performance -- however, the best practises have also evolved over time as performance inside of jQuery has improved, and browsers have improved (especially the advent of QSA). A lot of the literature out there on this comes from different points in history, which leads newcomers to get a skewed view of priorities. We should explain some of this history and use this article as the clearing house on what is currently "best," things like

  • not being overly specific in selectors
  • avoiding jQuery-only psuedoselectors
  • including quotes in attribute selectors to get into QSA
  • Sizzle vs. QSA
  • thoughts on balancing performance in fast modern browsers in QSA with oldIE
  • where selector performance fits into the general app performance picture

(Hoping to get a lift here from @timmywil after the Sizzle rewrite for 1.8. @crowchick proposed some content for this in #54 that could certainly be fleshed out here to anyone's heart's content)

ajpiano avatar Apr 09 '12 20:04 ajpiano

First step in #650.

arthurvr avatar Apr 16 '15 11:04 arthurvr