Bug Tracker

Opened 9 years ago

Last modified 8 years ago

#10697 closed bug

Sizzle revamp — at Version 3

Reported by: timmywil Owned by: timmywil
Priority: blocker Milestone: 1.8
Component: selector Version: 1.7
Keywords: Cc:
Blocked by: Blocking:

Description (last modified by timmywil)

This ticket is for tracking enhancements and reductions for Sizzle. Some of these may belong in separate tickets, but I need to compile the list somewhere. I plan on doing/researching all of this in 1.8.

These are my ideas so far:

  1. Reorganize the main Sizzle function to be one function that contains shortcuts for id, tag, class, and document.body and an internal select function that uses qsa if available. Sizzle somewhat does this already, but not completely. I think it would reduce the size of Sizzle itself. We also do some of this in jQuery.fn.init and duplicate some of what is already in a qsa Sizzle. This could remove the need for that duplication and shave even more bytes.
  2. This may not be feasible, but I want to look into adding local vars for the most common things referenced from within Sizzle instead of using.long.property.accesses internally.
  3. The implementation of prefilters seems a bit wet. I'd like to dry up some of that code and look into reducing the call stack on that codepath.
  4. Add a support-test regex builder for places in which we know QSA will fail, such as with :checked on select elements in webkit (there are about 6 others). This should not hurt performance at all if done correctly.
  5. Remove matchesSelector support completely. I know this sounds scary, but as Dave noticed in his event testing, even the native matchesSelector is really slow. It may actually be faster, especially in the most common use cases, to do our own filtering all the time. This could also remove the need for quickIs in event.js.
  6. Combine dirNodeCheck and dirCheck into a single function.
  7. Add a better fallback for Sizzle.contains.
  8. There are a couple tests for Opera 9.6 and Safari 3.2, which we don't support anymore, for getElementsByClassName. We could remove that cruft.
  9. Look into simplifying Sizzle's makeArray to not use Array slice at all. When building minimaljs, I noticed that a simple array builder is actually faster than using slice, so it does not seem worth it.
  10. Check how many bytes it would save to build the chunker and all other regexes using strings to reduce duplication.
  11. Follow spec for acceptable character ranges. Currently, we use "\u00c0-\uFFFF\", which may not be correct. third party pull https://github.com/jquery/sizzle/pull/61
  12. Double check the most up-to-date of w3c selectors and make sure we are not leaving any out that would be easy to support.

Change History (3)

comment:1 Changed 9 years ago by timmywil

Component: unfiledselector
Milestone: None1.8
Owner: set to timmywil
Priority: undecidedblocker
Status: newassigned

comment:2 Changed 9 years ago by Rick Waldron

Keywords: 1.8-discuss added

+1 !!!!!!

comment:3 Changed 9 years ago by timmywil

Description: modified (diff)
Note: See TracTickets for help on using tickets.