jquery / jquery/learn.jquery.com

Selector Performance

Open
#106 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Chapter: jquery-core Chapter: performance content meta-discuss
Dominant language
JavaScript
Stars
915
Forks
471
PR merge metrics
No merged PRs in 30d

Description

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)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the selector-performance topics listed in the issue, including QSA, Sizzle, jQuery-only pseudo-selectors, quoted attribute selectors, old IE, and broader application performance. Done means producing a current, historically grounded article that consolidates these recommendations for newcomers.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, jquery
Domain
documentation
Issue type
Documentation
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.