Bug Tracker

Ticket #10697 (closed bug: fixed)

Opened 3 years ago

Last modified 3 years ago

Sizzle revamp

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

Description (last modified by timmywil) (diff)

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

Change History

comment:1 Changed 3 years ago by timmywil

  • Owner set to timmywil
  • Priority changed from undecided to blocker
  • Status changed from new to assigned
  • Component changed from unfiled to selector
  • Milestone changed from None to 1.8

comment:2 Changed 3 years ago by rwaldron

  • Keywords 1.8-discuss added

+1 !!!!!!

comment:3 Changed 3 years ago by timmywil

  • Description modified (diff)

comment:4 Changed 3 years ago by mofle

+1 Awesome, sounds great!

comment:5 Changed 3 years ago by timmywil

  • Description modified (diff)

comment:6 Changed 3 years ago by dmethvin

  • Blocking 7010 added

comment:7 Changed 3 years ago by mikesherov

  • Description modified (diff)

+1, When people think jQuery, they think fast and simple selection. Sounds like this needs to be done.

comment:8 Changed 3 years ago by jzaefferer

+1

comment:9 Changed 3 years ago by jaubourg

+1

comment:10 Changed 3 years ago by dmethvin

  • Description modified (diff)

+1, In the 1.8 theme, it would also be nice if item 1 could be isolated as a "tiny Sizzle" -- let's call it "Small Fry"?

comment:11 Changed 3 years ago by hkdobrev@…

+1

comment:12 Changed 3 years ago by rwaldron

+1

comment:13 Changed 3 years ago by dmethvin

#11109 is a duplicate of this ticket.

comment:14 Changed 3 years ago by timmywil

  • Description modified (diff)

Moving 12 and 13 to their own tickets.

comment:15 Changed 3 years ago by timmywil

  • Keywords 1.8-discuss removed
  • Status changed from assigned to closed
  • Resolution set to fixed
  • Blocking 7010 removed
Note: See TracTickets for help on using tickets.