|
1 | 1 | /*! |
2 | | - * Sizzle CSS Selector Engine v2.3.9 |
| 2 | + * Sizzle CSS Selector Engine v2.3.10 |
3 | 3 | * https://sizzlejs.com/ |
4 | 4 | * |
5 | 5 | * Copyright JS Foundation and other contributors |
6 | 6 | * Released under the MIT license |
7 | 7 | * https://js.foundation/ |
8 | 8 | * |
9 | | - * Date: 2022-12-19 |
| 9 | + * Date: 2023-02-14 |
10 | 10 | */ |
11 | 11 | ( function( window ) { |
12 | 12 | var i, |
@@ -110,7 +110,7 @@ var i, |
110 | 110 | whitespace + "+$", "g" ), |
111 | 111 |
|
112 | 112 | rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ), |
113 | | - rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + |
| 113 | + rleadingCombinator = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + |
114 | 114 | "*" ), |
115 | 115 | rdescend = new RegExp( whitespace + "|>" ), |
116 | 116 |
|
@@ -327,7 +327,7 @@ function Sizzle( selector, context, results, seed ) { |
327 | 327 | // as such selectors are not recognized by querySelectorAll. |
328 | 328 | // Thanks to Andrew Dupont for this technique. |
329 | 329 | if ( nodeType === 1 && |
330 | | - ( rdescend.test( selector ) || rcombinators.test( selector ) ) ) { |
| 330 | + ( rdescend.test( selector ) || rleadingCombinator.test( selector ) ) ) { |
331 | 331 |
|
332 | 332 | // Expand context for sibling selectors |
333 | 333 | newContext = rsibling.test( selector ) && testContext( context.parentNode ) || |
@@ -356,27 +356,6 @@ function Sizzle( selector, context, results, seed ) { |
356 | 356 | } |
357 | 357 |
|
358 | 358 | try { |
359 | | - |
360 | | - // `qSA` may not throw for unrecognized parts using forgiving parsing: |
361 | | - // https://drafts.csswg.org/selectors/#forgiving-selector |
362 | | - // like the `:has()` pseudo-class: |
363 | | - // https://drafts.csswg.org/selectors/#relational |
364 | | - // `CSS.supports` is still expected to return `false` then: |
365 | | - // https://drafts.csswg.org/css-conditional-4/#typedef-supports-selector-fn |
366 | | - // https://drafts.csswg.org/css-conditional-4/#dfn-support-selector |
367 | | - if ( support.cssSupportsSelector && |
368 | | - |
369 | | - // eslint-disable-next-line no-undef |
370 | | - !CSS.supports( "selector(:is(" + newSelector + "))" ) ) { |
371 | | - |
372 | | - // Support: IE 11+ |
373 | | - // Throw to get to the same code path as an error directly in qSA. |
374 | | - // Note: once we only support browser supporting |
375 | | - // `CSS.supports('selector(...)')`, we can most likely drop |
376 | | - // the `try-catch`. IE doesn't implement the API. |
377 | | - throw new Error(); |
378 | | - } |
379 | | - |
380 | 359 | push.apply( results, |
381 | 360 | newContext.querySelectorAll( newSelector ) |
382 | 361 | ); |
@@ -672,29 +651,22 @@ setDocument = Sizzle.setDocument = function( node ) { |
672 | 651 | !el.querySelectorAll( ":scope fieldset div" ).length; |
673 | 652 | } ); |
674 | 653 |
|
675 | | - // Support: Chrome 105+, Firefox 104+, Safari 15.4+ |
676 | | - // Make sure forgiving mode is not used in `CSS.supports( "selector(...)" )`. |
677 | | - // |
678 | | - // `:is()` uses a forgiving selector list as an argument and is widely |
679 | | - // implemented, so it's a good one to test against. |
680 | | - support.cssSupportsSelector = assert( function() { |
681 | | - /* eslint-disable no-undef */ |
682 | | - |
683 | | - return CSS.supports( "selector(*)" ) && |
684 | | - |
685 | | - // Support: Firefox 78-81 only |
686 | | - // In old Firefox, `:is()` didn't use forgiving parsing. In that case, |
687 | | - // fail this test as there's no selector to test against that. |
688 | | - // `CSS.supports` uses unforgiving parsing |
689 | | - document.querySelectorAll( ":is(:jqfake)" ) && |
690 | | - |
691 | | - // `*` is needed as Safari & newer Chrome implemented something in between |
692 | | - // for `:has()` - it throws in `qSA` if it only contains an unsupported |
693 | | - // argument but multiple ones, one of which is supported, are fine. |
694 | | - // We want to play safe in case `:is()` gets the same treatment. |
695 | | - !CSS.supports( "selector(:is(*,:jqfake))" ); |
696 | | - |
697 | | - /* eslint-enable */ |
| 654 | + // Support: Chrome 105 - 110+, Safari 15.4 - 16.3+ |
| 655 | + // Make sure the the `:has()` argument is parsed unforgivingly. |
| 656 | + // We include `*` in the test to detect buggy implementations that are |
| 657 | + // _selectively_ forgiving (specifically when the list includes at least |
| 658 | + // one valid selector). |
| 659 | + // Note that we treat complete lack of support for `:has()` as if it were |
| 660 | + // spec-compliant support, which is fine because use of `:has()` in such |
| 661 | + // environments will fail in the qSA path and fall back to jQuery traversal |
| 662 | + // anyway. |
| 663 | + support.cssHas = assert( function() { |
| 664 | + try { |
| 665 | + document.querySelector( ":has(*,:jqfake)" ); |
| 666 | + return false; |
| 667 | + } catch ( e ) { |
| 668 | + return true; |
| 669 | + } |
698 | 670 | } ); |
699 | 671 |
|
700 | 672 | /* Attributes |
@@ -963,14 +935,14 @@ setDocument = Sizzle.setDocument = function( node ) { |
963 | 935 | } ); |
964 | 936 | } |
965 | 937 |
|
966 | | - if ( !support.cssSupportsSelector ) { |
| 938 | + if ( !support.cssHas ) { |
967 | 939 |
|
968 | | - // Support: Chrome 105+, Safari 15.4+ |
969 | | - // `:has()` uses a forgiving selector list as an argument so our regular |
970 | | - // `try-catch` mechanism fails to catch `:has()` with arguments not supported |
971 | | - // natively like `:has(:contains("Foo"))`. Where supported & spec-compliant, |
972 | | - // we now use `CSS.supports("selector(:is(SELECTOR_TO_BE_TESTED))")`, but |
973 | | - // outside that we mark `:has` as buggy. |
| 940 | + // Support: Chrome 105 - 110+, Safari 15.4 - 16.3+ |
| 941 | + // Our regular `try-catch` mechanism fails to detect natively-unsupported |
| 942 | + // pseudo-classes inside `:has()` (such as `:has(:contains("Foo"))`) |
| 943 | + // in browsers that parse the `:has()` argument as a forgiving selector list. |
| 944 | + // https://drafts.csswg.org/selectors/#relational now requires the argument |
| 945 | + // to be parsed unforgivingly, but browsers have not yet fully adjusted. |
974 | 946 | rbuggyQSA.push( ":has" ); |
975 | 947 | } |
976 | 948 |
|
@@ -1883,7 +1855,7 @@ tokenize = Sizzle.tokenize = function( selector, parseOnly ) { |
1883 | 1855 | matched = false; |
1884 | 1856 |
|
1885 | 1857 | // Combinators |
1886 | | - if ( ( match = rcombinators.exec( soFar ) ) ) { |
| 1858 | + if ( ( match = rleadingCombinator.exec( soFar ) ) ) { |
1887 | 1859 | matched = match.shift(); |
1888 | 1860 | tokens.push( { |
1889 | 1861 | value: matched, |
|
0 commit comments