Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commited66d5a

Browse files
authored
Selector: Make selectors with leading combinators use qSA again
An optimization added injquery/sizzle#431 skips the temporary IDs for selectorsnot using child or descendant combinators. For sibling combinators, though, thispushes a selector with a leading combinator to qSA directly which crashes andfalls back to a slower Sizzle route.This commit makes selectors with leading combinators not skip the selectorrewriting. Note that after#4454 &jquery/sizzle#453, all modernbrowsers other than Edge leverage the :scope pseudo-class, avoiding temporaryid attributes.Closesgh-4509Refjquery/sizzle#431
1 parentbbad821 commited66d5a

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

‎src/selector.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,8 +226,11 @@ function find( selector, context, results, seed ) {
226226
// descendant combinators, which is not what we want.
227227
// In such cases, we work around the behavior by prefixing every selector in the
228228
// list with an ID selector referencing the scope context.
229+
// The technique has to be used as well when a leading combinator is used
230+
// as such selectors are not recognized by querySelectorAll.
229231
// Thanks to Andrew Dupont for this technique.
230-
if(nodeType===1&&rdescend.test(selector)){
232+
if(nodeType===1&&
233+
(rdescend.test(selector)||rcombinators.test(selector))){
231234

232235
// Expand context for sibling selectors
233236
newContext=rsibling.test(selector)&&testContext(context.parentNode)||

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp