11/*!
2- * Sizzle CSS Selector Engine v2.3.3
2+ * Sizzle CSS Selector Engine v2.3.4
33 * https://sizzlejs.com/
44 *
5- * Copyright jQuery Foundation and other contributors
5+ * Copyright JS Foundation and other contributors
66 * Released under the MIT license
7- * http ://jquery.org/license
7+ * https ://js.foundation/
88 *
9- * Date: 2016-08 -08
9+ * Date: 2019-04 -08
1010 */
1111( function ( window ) {
1212
4040 classCache = createCache ( ) ,
4141 tokenCache = createCache ( ) ,
4242 compilerCache = createCache ( ) ,
43+ nonnativeSelectorCache = createCache ( ) ,
4344 sortOrder = function ( a , b ) {
4445 if ( a === b ) {
4546 hasDuplicate = true ;
@@ -101,8 +102,7 @@ var i,
101102
102103 rcomma = new RegExp ( "^" + whitespace + "*," + whitespace + "*" ) ,
103104 rcombinators = new RegExp ( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ) ,
104-
105- rattributeQuotes = new RegExp ( "=" + whitespace + "*([^\\]'\"]*?)" + whitespace + "*\\]" , "g" ) ,
105+ rdescend = new RegExp ( whitespace + "|>" ) ,
106106
107107 rpseudo = new RegExp ( pseudos ) ,
108108 ridentifier = new RegExp ( "^" + identifier + "$" ) ,
@@ -123,6 +123,7 @@ var i,
123123 whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)" , "i" )
124124 } ,
125125
126+ rhtml = / H T M L $ / i,
126127 rinputs = / ^ (?: i n p u t | s e l e c t | t e x t a r e a | b u t t o n ) $ / i,
127128 rheader = / ^ h \d $ / i,
128129
@@ -177,9 +178,9 @@ var i,
177178 setDocument ( ) ;
178179 } ,
179180
180- disabledAncestor = addCombinator (
181+ inDisabledFieldset = addCombinator (
181182 function ( elem ) {
182- return elem . disabled === true && ( "form" in elem || "label" in elem ) ;
183+ return elem . disabled === true && elem . nodeName . toLowerCase ( ) === "fieldset" ;
183184 } ,
184185 { dir : "parentNode" , next : "legend" }
185186 ) ;
@@ -292,18 +293,22 @@ function Sizzle( selector, context, results, seed ) {
292293
293294 // Take advantage of querySelectorAll
294295 if ( support . qsa &&
295- ! compilerCache [ selector + " " ] &&
296- ( ! rbuggyQSA || ! rbuggyQSA . test ( selector ) ) ) {
297-
298- if ( nodeType !== 1 ) {
299- newContext = context ;
300- newSelector = selector ;
296+ ! nonnativeSelectorCache [ selector + " " ] &&
297+ ( ! rbuggyQSA || ! rbuggyQSA . test ( selector ) ) &&
301298
302- // qSA looks outside Element context, which is not what we want
303- // Thanks to Andrew Dupont for this workaround technique
304- // Support: IE <=8
299+ // Support: IE 8 only
305300 // Exclude object elements
306- } else if ( context . nodeName . toLowerCase ( ) !== "object" ) {
301+ ( nodeType !== 1 || context . nodeName . toLowerCase ( ) !== "object" ) ) {
302+
303+ newSelector = selector ;
304+ newContext = context ;
305+
306+ // qSA considers elements outside a scoping root when evaluating child or
307+ // descendant combinators, which is not what we want.
308+ // In such cases, we work around the behavior by prefixing every selector in the
309+ // list with an ID selector referencing the scope context.
310+ // Thanks to Andrew Dupont for this technique.
311+ if ( nodeType === 1 && rdescend . test ( selector ) ) {
307312
308313 // Capture the context ID, setting it first if necessary
309314 if ( ( nid = context . getAttribute ( "id" ) ) ) {
@@ -325,17 +330,16 @@ function Sizzle( selector, context, results, seed ) {
325330 context ;
326331 }
327332
328- if ( newSelector ) {
329- try {
330- push . apply ( results ,
331- newContext . querySelectorAll ( newSelector )
332- ) ;
333- return results ;
334- } catch ( qsaError ) {
335- } finally {
336- if ( nid === expando ) {
337- context . removeAttribute ( "id" ) ;
338- }
333+ try {
334+ push . apply ( results ,
335+ newContext . querySelectorAll ( newSelector )
336+ ) ;
337+ return results ;
338+ } catch ( qsaError ) {
339+ nonnativeSelectorCache ( selector , true ) ;
340+ } finally {
341+ if ( nid === expando ) {
342+ context . removeAttribute ( "id" ) ;
339343 }
340344 }
341345 }
@@ -499,7 +503,7 @@ function createDisabledPseudo( disabled ) {
499503 // Where there is no isDisabled, check manually
500504 /* jshint -W018 */
501505 elem . isDisabled !== ! disabled &&
502- disabledAncestor ( elem ) === disabled ;
506+ inDisabledFieldset ( elem ) === disabled ;
503507 }
504508
505509 return elem . disabled === disabled ;
@@ -556,10 +560,13 @@ support = Sizzle.support = {};
556560 * @returns {Boolean } True iff elem is a non-HTML XML node
557561 */
558562isXML = Sizzle . isXML = function ( elem ) {
559- // documentElement is verified for cases where it doesn't yet exist
560- // (such as loading iframes in IE - #4833)
561- var documentElement = elem && ( elem . ownerDocument || elem ) . documentElement ;
562- return documentElement ? documentElement . nodeName !== "HTML" : false ;
563+ var namespace = elem . namespaceURI ,
564+ docElem = ( elem . ownerDocument || elem ) . documentElement ;
565+
566+ // Support: IE <=8
567+ // Assume HTML when documentElement doesn't yet exist, such as inside loading iframes
568+ // https://bugs.jquery.com/ticket/4833
569+ return ! rhtml . test ( namespace || docElem && docElem . nodeName || "HTML" ) ;
563570} ;
564571
565572/**
@@ -981,11 +988,8 @@ Sizzle.matchesSelector = function( elem, expr ) {
981988 setDocument ( elem ) ;
982989 }
983990
984- // Make sure that attribute selectors are quoted
985- expr = expr . replace ( rattributeQuotes , "='$1']" ) ;
986-
987991 if ( support . matchesSelector && documentIsHTML &&
988- ! compilerCache [ expr + " " ] &&
992+ ! nonnativeSelectorCache [ expr + " " ] &&
989993 ( ! rbuggyMatches || ! rbuggyMatches . test ( expr ) ) &&
990994 ( ! rbuggyQSA || ! rbuggyQSA . test ( expr ) ) ) {
991995
@@ -999,7 +1003,9 @@ Sizzle.matchesSelector = function( elem, expr ) {
9991003 elem . document && elem . document . nodeType !== 11 ) {
10001004 return ret ;
10011005 }
1002- } catch ( e ) { }
1006+ } catch ( e ) {
1007+ nonnativeSelectorCache ( expr , true ) ;
1008+ }
10031009 }
10041010
10051011 return Sizzle ( expr , document , null , [ elem ] ) . length > 0 ;
@@ -1458,7 +1464,7 @@ Expr = Sizzle.selectors = {
14581464 "contains" : markFunction ( function ( text ) {
14591465 text = text . replace ( runescape , funescape ) ;
14601466 return function ( elem ) {
1461- return ( elem . textContent || elem . innerText || getText ( elem ) ) . indexOf ( text ) > - 1 ;
1467+ return ( elem . textContent || getText ( elem ) ) . indexOf ( text ) > - 1 ;
14621468 } ;
14631469 } ) ,
14641470
@@ -1597,7 +1603,11 @@ Expr = Sizzle.selectors = {
15971603 } ) ,
15981604
15991605 "lt" : createPositionalPseudo ( function ( matchIndexes , length , argument ) {
1600- var i = argument < 0 ? argument + length : argument ;
1606+ var i = argument < 0 ?
1607+ argument + length :
1608+ argument > length ?
1609+ length :
1610+ argument ;
16011611 for ( ; -- i >= 0 ; ) {
16021612 matchIndexes . push ( i ) ;
16031613 }
0 commit comments