jquery / sizzle

A sizzlin' hot selector engine.
https://sizzlejs.com
Other
6.29k stars 951 forks source link

Selector: Make selectors with leading combinators use qSA again #460

Closed mgol closed 5 years ago

mgol commented 5 years ago

An optimization added in jquery/sizzle#431 skips the temporary IDs for selectors not using child or descendant combinators. For sibling combinators, though, this pushes a selector with a leading combinator to qSA directly which crashes and falls back to a slower Sizzle route.

This commit makes selectors with leading combinators not skip the selector rewriting. Note that after jquery/jquery#4454 & jquery/sizzle#453, all modern browsers other than Edge leverage the :scope pseudo-class, avoiding temporary id attributes.

Ref gh-431

jQuery PR (for jQuery 4.0): https://github.com/jquery/jquery/pull/4509