jquery-rails 4.5.1 → 4.6.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,15 +1,12 @@
1
1
  /*!
2
- * jQuery JavaScript Library v3.6.1
2
+ * jQuery JavaScript Library v3.7.0
3
3
  * https://jquery.com/
4
4
  *
5
- * Includes Sizzle.js
6
- * https://sizzlejs.com/
7
- *
8
5
  * Copyright OpenJS Foundation and other contributors
9
6
  * Released under the MIT license
10
7
  * https://jquery.org/license
11
8
  *
12
- * Date: 2022-08-26T17:52Z
9
+ * Date: 2023-05-11T18:29Z
13
10
  */
14
11
  ( function( global, factory ) {
15
12
 
@@ -150,8 +147,9 @@ function toType( obj ) {
150
147
 
151
148
 
152
149
 
153
- var
154
- version = "3.6.1",
150
+ var version = "3.7.0",
151
+
152
+ rhtmlSuffix = /HTML$/i,
155
153
 
156
154
  // Define a local copy of jQuery
157
155
  jQuery = function( selector, context ) {
@@ -397,6 +395,33 @@ jQuery.extend( {
397
395
  return obj;
398
396
  },
399
397
 
398
+
399
+ // Retrieve the text value of an array of DOM nodes
400
+ text: function( elem ) {
401
+ var node,
402
+ ret = "",
403
+ i = 0,
404
+ nodeType = elem.nodeType;
405
+
406
+ if ( !nodeType ) {
407
+
408
+ // If no nodeType, this is expected to be an array
409
+ while ( ( node = elem[ i++ ] ) ) {
410
+
411
+ // Do not traverse comment nodes
412
+ ret += jQuery.text( node );
413
+ }
414
+ } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
415
+ return elem.textContent;
416
+ } else if ( nodeType === 3 || nodeType === 4 ) {
417
+ return elem.nodeValue;
418
+ }
419
+
420
+ // Do not include comment or processing instruction nodes
421
+
422
+ return ret;
423
+ },
424
+
400
425
  // results is for internal usage only
401
426
  makeArray: function( arr, results ) {
402
427
  var ret = results || [];
@@ -419,6 +444,15 @@ jQuery.extend( {
419
444
  return arr == null ? -1 : indexOf.call( arr, elem, i );
420
445
  },
421
446
 
447
+ isXMLDoc: function( elem ) {
448
+ var namespace = elem && elem.namespaceURI,
449
+ docElem = elem && ( elem.ownerDocument || elem ).documentElement;
450
+
451
+ // Assume HTML when documentElement doesn't yet exist, such as inside
452
+ // document fragments.
453
+ return !rhtmlSuffix.test( namespace || docElem && docElem.nodeName || "HTML" );
454
+ },
455
+
422
456
  // Support: Android <=4.0 only, PhantomJS 1 only
423
457
  // push.apply(_, arraylike) throws on ancient WebKit
424
458
  merge: function( first, second ) {
@@ -520,43 +554,98 @@ function isArrayLike( obj ) {
520
554
  return type === "array" || length === 0 ||
521
555
  typeof length === "number" && length > 0 && ( length - 1 ) in obj;
522
556
  }
523
- var Sizzle =
524
- /*!
525
- * Sizzle CSS Selector Engine v2.3.6
526
- * https://sizzlejs.com/
527
- *
528
- * Copyright JS Foundation and other contributors
529
- * Released under the MIT license
530
- * https://js.foundation/
531
- *
532
- * Date: 2021-02-16
533
- */
534
- ( function( window ) {
557
+
558
+
559
+ function nodeName( elem, name ) {
560
+
561
+ return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
562
+
563
+ }
564
+ var pop = arr.pop;
565
+
566
+
567
+ var sort = arr.sort;
568
+
569
+
570
+ var splice = arr.splice;
571
+
572
+
573
+ var whitespace = "[\\x20\\t\\r\\n\\f]";
574
+
575
+
576
+ var rtrimCSS = new RegExp(
577
+ "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$",
578
+ "g"
579
+ );
580
+
581
+
582
+
583
+
584
+ // Note: an element does not contain itself
585
+ jQuery.contains = function( a, b ) {
586
+ var bup = b && b.parentNode;
587
+
588
+ return a === bup || !!( bup && bup.nodeType === 1 && (
589
+
590
+ // Support: IE 9 - 11+
591
+ // IE doesn't have `contains` on SVG.
592
+ a.contains ?
593
+ a.contains( bup ) :
594
+ a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
595
+ ) );
596
+ };
597
+
598
+
599
+
600
+
601
+ // CSS string/identifier serialization
602
+ // https://drafts.csswg.org/cssom/#common-serializing-idioms
603
+ var rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\x80-\uFFFF\w-]/g;
604
+
605
+ function fcssescape( ch, asCodePoint ) {
606
+ if ( asCodePoint ) {
607
+
608
+ // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER
609
+ if ( ch === "\0" ) {
610
+ return "\uFFFD";
611
+ }
612
+
613
+ // Control characters and (dependent upon position) numbers get escaped as code points
614
+ return ch.slice( 0, -1 ) + "\\" + ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " ";
615
+ }
616
+
617
+ // Other potentially-special ASCII characters get backslash-escaped
618
+ return "\\" + ch;
619
+ }
620
+
621
+ jQuery.escapeSelector = function( sel ) {
622
+ return ( sel + "" ).replace( rcssescape, fcssescape );
623
+ };
624
+
625
+
626
+
627
+
628
+ var preferredDoc = document,
629
+ pushNative = push;
630
+
631
+ ( function() {
632
+
535
633
  var i,
536
- support,
537
634
  Expr,
538
- getText,
539
- isXML,
540
- tokenize,
541
- compile,
542
- select,
543
635
  outermostContext,
544
636
  sortInput,
545
637
  hasDuplicate,
638
+ push = pushNative,
546
639
 
547
640
  // Local document vars
548
- setDocument,
549
641
  document,
550
- docElem,
642
+ documentElement,
551
643
  documentIsHTML,
552
644
  rbuggyQSA,
553
- rbuggyMatches,
554
645
  matches,
555
- contains,
556
646
 
557
647
  // Instance-specific data
558
- expando = "sizzle" + 1 * new Date(),
559
- preferredDoc = window.document,
648
+ expando = jQuery.expando,
560
649
  dirruns = 0,
561
650
  done = 0,
562
651
  classCache = createCache(),
@@ -570,47 +659,22 @@ var i,
570
659
  return 0;
571
660
  },
572
661
 
573
- // Instance methods
574
- hasOwn = ( {} ).hasOwnProperty,
575
- arr = [],
576
- pop = arr.pop,
577
- pushNative = arr.push,
578
- push = arr.push,
579
- slice = arr.slice,
580
-
581
- // Use a stripped-down indexOf as it's faster than native
582
- // https://jsperf.com/thor-indexof-vs-for/5
583
- indexOf = function( list, elem ) {
584
- var i = 0,
585
- len = list.length;
586
- for ( ; i < len; i++ ) {
587
- if ( list[ i ] === elem ) {
588
- return i;
589
- }
590
- }
591
- return -1;
592
- },
593
-
594
- booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|" +
595
- "ismap|loop|multiple|open|readonly|required|scoped",
662
+ booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|" +
663
+ "loop|multiple|open|readonly|required|scoped",
596
664
 
597
665
  // Regular expressions
598
666
 
599
- // http://www.w3.org/TR/css3-selectors/#whitespace
600
- whitespace = "[\\x20\\t\\r\\n\\f]",
601
-
602
667
  // https://www.w3.org/TR/css-syntax-3/#ident-token-diagram
603
668
  identifier = "(?:\\\\[\\da-fA-F]{1,6}" + whitespace +
604
669
  "?|\\\\[^\\r\\n\\f]|[\\w-]|[^\0-\\x7f])+",
605
670
 
606
- // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors
671
+ // Attribute selectors: https://www.w3.org/TR/selectors/#attribute-selectors
607
672
  attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace +
608
673
 
609
674
  // Operator (capture 2)
610
675
  "*([*^$|!~]?=)" + whitespace +
611
676
 
612
- // "Attribute values must be CSS identifiers [capture 5]
613
- // or strings [capture 3 or capture 4]"
677
+ // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]"
614
678
  "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" +
615
679
  whitespace + "*\\]",
616
680
 
@@ -629,101 +693,88 @@ var i,
629
693
 
630
694
  // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
631
695
  rwhitespace = new RegExp( whitespace + "+", "g" ),
632
- rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" +
633
- whitespace + "+$", "g" ),
634
696
 
635
697
  rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
636
- rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace +
637
- "*" ),
698
+ rleadingCombinator = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" +
699
+ whitespace + "*" ),
638
700
  rdescend = new RegExp( whitespace + "|>" ),
639
701
 
640
702
  rpseudo = new RegExp( pseudos ),
641
703
  ridentifier = new RegExp( "^" + identifier + "$" ),
642
704
 
643
705
  matchExpr = {
644
- "ID": new RegExp( "^#(" + identifier + ")" ),
645
- "CLASS": new RegExp( "^\\.(" + identifier + ")" ),
646
- "TAG": new RegExp( "^(" + identifier + "|[*])" ),
647
- "ATTR": new RegExp( "^" + attributes ),
648
- "PSEUDO": new RegExp( "^" + pseudos ),
649
- "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" +
650
- whitespace + "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" +
651
- whitespace + "*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
652
- "bool": new RegExp( "^(?:" + booleans + ")$", "i" ),
706
+ ID: new RegExp( "^#(" + identifier + ")" ),
707
+ CLASS: new RegExp( "^\\.(" + identifier + ")" ),
708
+ TAG: new RegExp( "^(" + identifier + "|[*])" ),
709
+ ATTR: new RegExp( "^" + attributes ),
710
+ PSEUDO: new RegExp( "^" + pseudos ),
711
+ CHILD: new RegExp(
712
+ "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" +
713
+ whitespace + "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" +
714
+ whitespace + "*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
715
+ bool: new RegExp( "^(?:" + booleans + ")$", "i" ),
653
716
 
654
717
  // For use in libraries implementing .is()
655
718
  // We use this for POS matching in `select`
656
- "needsContext": new RegExp( "^" + whitespace +
719
+ needsContext: new RegExp( "^" + whitespace +
657
720
  "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + whitespace +
658
721
  "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )
659
722
  },
660
723
 
661
- rhtml = /HTML$/i,
662
724
  rinputs = /^(?:input|select|textarea|button)$/i,
663
725
  rheader = /^h\d$/i,
664
726
 
665
- rnative = /^[^{]+\{\s*\[native \w/,
666
-
667
727
  // Easily-parseable/retrievable ID or TAG or CLASS selectors
668
728
  rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
669
729
 
670
730
  rsibling = /[+~]/,
671
731
 
672
732
  // CSS escapes
673
- // http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
674
- runescape = new RegExp( "\\\\[\\da-fA-F]{1,6}" + whitespace + "?|\\\\([^\\r\\n\\f])", "g" ),
733
+ // https://www.w3.org/TR/CSS21/syndata.html#escaped-characters
734
+ runescape = new RegExp( "\\\\[\\da-fA-F]{1,6}" + whitespace +
735
+ "?|\\\\([^\\r\\n\\f])", "g" ),
675
736
  funescape = function( escape, nonHex ) {
676
737
  var high = "0x" + escape.slice( 1 ) - 0x10000;
677
738
 
678
- return nonHex ?
739
+ if ( nonHex ) {
679
740
 
680
741
  // Strip the backslash prefix from a non-hex escape sequence
681
- nonHex :
682
-
683
- // Replace a hexadecimal escape sequence with the encoded Unicode code point
684
- // Support: IE <=11+
685
- // For values outside the Basic Multilingual Plane (BMP), manually construct a
686
- // surrogate pair
687
- high < 0 ?
688
- String.fromCharCode( high + 0x10000 ) :
689
- String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
690
- },
691
-
692
- // CSS string/identifier serialization
693
- // https://drafts.csswg.org/cssom/#common-serializing-idioms
694
- rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,
695
- fcssescape = function( ch, asCodePoint ) {
696
- if ( asCodePoint ) {
697
-
698
- // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER
699
- if ( ch === "\0" ) {
700
- return "\uFFFD";
701
- }
702
-
703
- // Control characters and (dependent upon position) numbers get escaped as code points
704
- return ch.slice( 0, -1 ) + "\\" +
705
- ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " ";
742
+ return nonHex;
706
743
  }
707
744
 
708
- // Other potentially-special ASCII characters get backslash-escaped
709
- return "\\" + ch;
745
+ // Replace a hexadecimal escape sequence with the encoded Unicode code point
746
+ // Support: IE <=11+
747
+ // For values outside the Basic Multilingual Plane (BMP), manually construct a
748
+ // surrogate pair
749
+ return high < 0 ?
750
+ String.fromCharCode( high + 0x10000 ) :
751
+ String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
710
752
  },
711
753
 
712
- // Used for iframes
713
- // See setDocument()
754
+ // Used for iframes; see `setDocument`.
755
+ // Support: IE 9 - 11+, Edge 12 - 18+
714
756
  // Removing the function wrapper causes a "Permission Denied"
715
- // error in IE
757
+ // error in IE/Edge.
716
758
  unloadHandler = function() {
717
759
  setDocument();
718
760
  },
719
761
 
720
762
  inDisabledFieldset = addCombinator(
721
763
  function( elem ) {
722
- return elem.disabled === true && elem.nodeName.toLowerCase() === "fieldset";
764
+ return elem.disabled === true && nodeName( elem, "fieldset" );
723
765
  },
724
766
  { dir: "parentNode", next: "legend" }
725
767
  );
726
768
 
769
+ // Support: IE <=9 only
770
+ // Accessing document.activeElement can throw unexpectedly
771
+ // https://bugs.jquery.com/ticket/13393
772
+ function safeActiveElement() {
773
+ try {
774
+ return document.activeElement;
775
+ } catch ( err ) { }
776
+ }
777
+
727
778
  // Optimize for push.apply( _, NodeList )
728
779
  try {
729
780
  push.apply(
@@ -731,32 +782,22 @@ try {
731
782
  preferredDoc.childNodes
732
783
  );
733
784
 
734
- // Support: Android<4.0
785
+ // Support: Android <=4.0
735
786
  // Detect silently failing push.apply
736
787
  // eslint-disable-next-line no-unused-expressions
737
788
  arr[ preferredDoc.childNodes.length ].nodeType;
738
789
  } catch ( e ) {
739
- push = { apply: arr.length ?
740
-
741
- // Leverage slice if possible
742
- function( target, els ) {
790
+ push = {
791
+ apply: function( target, els ) {
743
792
  pushNative.apply( target, slice.call( els ) );
744
- } :
745
-
746
- // Support: IE<9
747
- // Otherwise append directly
748
- function( target, els ) {
749
- var j = target.length,
750
- i = 0;
751
-
752
- // Can't trust NodeList.length
753
- while ( ( target[ j++ ] = els[ i++ ] ) ) {}
754
- target.length = j - 1;
793
+ },
794
+ call: function( target ) {
795
+ pushNative.apply( target, slice.call( arguments, 1 ) );
755
796
  }
756
797
  };
757
798
  }
758
799
 
759
- function Sizzle( selector, context, results, seed ) {
800
+ function find( selector, context, results, seed ) {
760
801
  var m, i, elem, nid, match, groups, newSelector,
761
802
  newContext = context && context.ownerDocument,
762
803
 
@@ -790,11 +831,10 @@ function Sizzle( selector, context, results, seed ) {
790
831
  if ( nodeType === 9 ) {
791
832
  if ( ( elem = context.getElementById( m ) ) ) {
792
833
 
793
- // Support: IE, Opera, Webkit
794
- // TODO: identify versions
834
+ // Support: IE 9 only
795
835
  // getElementById can match elements by name instead of ID
796
836
  if ( elem.id === m ) {
797
- results.push( elem );
837
+ push.call( results, elem );
798
838
  return results;
799
839
  }
800
840
  } else {
@@ -804,14 +844,13 @@ function Sizzle( selector, context, results, seed ) {
804
844
  // Element context
805
845
  } else {
806
846
 
807
- // Support: IE, Opera, Webkit
808
- // TODO: identify versions
847
+ // Support: IE 9 only
809
848
  // getElementById can match elements by name instead of ID
810
849
  if ( newContext && ( elem = newContext.getElementById( m ) ) &&
811
- contains( context, elem ) &&
850
+ find.contains( context, elem ) &&
812
851
  elem.id === m ) {
813
852
 
814
- results.push( elem );
853
+ push.call( results, elem );
815
854
  return results;
816
855
  }
817
856
  }
@@ -822,22 +861,15 @@ function Sizzle( selector, context, results, seed ) {
822
861
  return results;
823
862
 
824
863
  // Class selector
825
- } else if ( ( m = match[ 3 ] ) && support.getElementsByClassName &&
826
- context.getElementsByClassName ) {
827
-
864
+ } else if ( ( m = match[ 3 ] ) && context.getElementsByClassName ) {
828
865
  push.apply( results, context.getElementsByClassName( m ) );
829
866
  return results;
830
867
  }
831
868
  }
832
869
 
833
870
  // Take advantage of querySelectorAll
834
- if ( support.qsa &&
835
- !nonnativeSelectorCache[ selector + " " ] &&
836
- ( !rbuggyQSA || !rbuggyQSA.test( selector ) ) &&
837
-
838
- // Support: IE 8 only
839
- // Exclude object elements
840
- ( nodeType !== 1 || context.nodeName.toLowerCase() !== "object" ) ) {
871
+ if ( !nonnativeSelectorCache[ selector + " " ] &&
872
+ ( !rbuggyQSA || !rbuggyQSA.test( selector ) ) ) {
841
873
 
842
874
  newSelector = selector;
843
875
  newContext = context;
@@ -850,7 +882,7 @@ function Sizzle( selector, context, results, seed ) {
850
882
  // as such selectors are not recognized by querySelectorAll.
851
883
  // Thanks to Andrew Dupont for this technique.
852
884
  if ( nodeType === 1 &&
853
- ( rdescend.test( selector ) || rcombinators.test( selector ) ) ) {
885
+ ( rdescend.test( selector ) || rleadingCombinator.test( selector ) ) ) {
854
886
 
855
887
  // Expand context for sibling selectors
856
888
  newContext = rsibling.test( selector ) && testContext( context.parentNode ) ||
@@ -858,11 +890,15 @@ function Sizzle( selector, context, results, seed ) {
858
890
 
859
891
  // We can use :scope instead of the ID hack if the browser
860
892
  // supports it & if we're not changing the context.
861
- if ( newContext !== context || !support.scope ) {
893
+ // Support: IE 11+, Edge 17 - 18+
894
+ // IE/Edge sometimes throw a "Permission denied" error when
895
+ // strict-comparing two documents; shallow comparisons work.
896
+ // eslint-disable-next-line eqeqeq
897
+ if ( newContext != context || !support.scope ) {
862
898
 
863
899
  // Capture the context ID, setting it first if necessary
864
900
  if ( ( nid = context.getAttribute( "id" ) ) ) {
865
- nid = nid.replace( rcssescape, fcssescape );
901
+ nid = jQuery.escapeSelector( nid );
866
902
  } else {
867
903
  context.setAttribute( "id", ( nid = expando ) );
868
904
  }
@@ -895,7 +931,7 @@ function Sizzle( selector, context, results, seed ) {
895
931
  }
896
932
 
897
933
  // All others
898
- return select( selector.replace( rtrim, "$1" ), context, results, seed );
934
+ return select( selector.replace( rtrimCSS, "$1" ), context, results, seed );
899
935
  }
900
936
 
901
937
  /**
@@ -909,7 +945,8 @@ function createCache() {
909
945
 
910
946
  function cache( key, value ) {
911
947
 
912
- // Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
948
+ // Use (key + " ") to avoid collision with native prototype properties
949
+ // (see https://github.com/jquery/sizzle/issues/157)
913
950
  if ( keys.push( key + " " ) > Expr.cacheLength ) {
914
951
 
915
952
  // Only keep the most recent entries
@@ -921,7 +958,7 @@ function createCache() {
921
958
  }
922
959
 
923
960
  /**
924
- * Mark a function for special use by Sizzle
961
+ * Mark a function for special use by jQuery selector module
925
962
  * @param {Function} fn The function to mark
926
963
  */
927
964
  function markFunction( fn ) {
@@ -952,56 +989,13 @@ function assert( fn ) {
952
989
  }
953
990
  }
954
991
 
955
- /**
956
- * Adds the same handler for all of the specified attrs
957
- * @param {String} attrs Pipe-separated list of attributes
958
- * @param {Function} handler The method that will be applied
959
- */
960
- function addHandle( attrs, handler ) {
961
- var arr = attrs.split( "|" ),
962
- i = arr.length;
963
-
964
- while ( i-- ) {
965
- Expr.attrHandle[ arr[ i ] ] = handler;
966
- }
967
- }
968
-
969
- /**
970
- * Checks document order of two siblings
971
- * @param {Element} a
972
- * @param {Element} b
973
- * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b
974
- */
975
- function siblingCheck( a, b ) {
976
- var cur = b && a,
977
- diff = cur && a.nodeType === 1 && b.nodeType === 1 &&
978
- a.sourceIndex - b.sourceIndex;
979
-
980
- // Use IE sourceIndex if available on both nodes
981
- if ( diff ) {
982
- return diff;
983
- }
984
-
985
- // Check if b follows a
986
- if ( cur ) {
987
- while ( ( cur = cur.nextSibling ) ) {
988
- if ( cur === b ) {
989
- return -1;
990
- }
991
- }
992
- }
993
-
994
- return a ? 1 : -1;
995
- }
996
-
997
992
  /**
998
993
  * Returns a function to use in pseudos for input types
999
994
  * @param {String} type
1000
995
  */
1001
996
  function createInputPseudo( type ) {
1002
997
  return function( elem ) {
1003
- var name = elem.nodeName.toLowerCase();
1004
- return name === "input" && elem.type === type;
998
+ return nodeName( elem, "input" ) && elem.type === type;
1005
999
  };
1006
1000
  }
1007
1001
 
@@ -1011,8 +1005,8 @@ function createInputPseudo( type ) {
1011
1005
  */
1012
1006
  function createButtonPseudo( type ) {
1013
1007
  return function( elem ) {
1014
- var name = elem.nodeName.toLowerCase();
1015
- return ( name === "input" || name === "button" ) && elem.type === type;
1008
+ return ( nodeName( elem, "input" ) || nodeName( elem, "button" ) ) &&
1009
+ elem.type === type;
1016
1010
  };
1017
1011
  }
1018
1012
 
@@ -1048,14 +1042,13 @@ function createDisabledPseudo( disabled ) {
1048
1042
  }
1049
1043
  }
1050
1044
 
1051
- // Support: IE 6 - 11
1045
+ // Support: IE 6 - 11+
1052
1046
  // Use the isDisabled shortcut property to check for disabled fieldset ancestors
1053
1047
  return elem.isDisabled === disabled ||
1054
1048
 
1055
1049
  // Where there is no isDisabled, check manually
1056
- /* jshint -W018 */
1057
1050
  elem.isDisabled !== !disabled &&
1058
- inDisabledFieldset( elem ) === disabled;
1051
+ inDisabledFieldset( elem ) === disabled;
1059
1052
  }
1060
1053
 
1061
1054
  return elem.disabled === disabled;
@@ -1095,7 +1088,7 @@ function createPositionalPseudo( fn ) {
1095
1088
  }
1096
1089
 
1097
1090
  /**
1098
- * Checks a node for validity as a Sizzle context
1091
+ * Checks a node for validity as a jQuery selector context
1099
1092
  * @param {Element|Object=} context
1100
1093
  * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value
1101
1094
  */
@@ -1103,31 +1096,13 @@ function testContext( context ) {
1103
1096
  return context && typeof context.getElementsByTagName !== "undefined" && context;
1104
1097
  }
1105
1098
 
1106
- // Expose support vars for convenience
1107
- support = Sizzle.support = {};
1108
-
1109
- /**
1110
- * Detects XML nodes
1111
- * @param {Element|Object} elem An element or a document
1112
- * @returns {Boolean} True iff elem is a non-HTML XML node
1113
- */
1114
- isXML = Sizzle.isXML = function( elem ) {
1115
- var namespace = elem && elem.namespaceURI,
1116
- docElem = elem && ( elem.ownerDocument || elem ).documentElement;
1117
-
1118
- // Support: IE <=8
1119
- // Assume HTML when documentElement doesn't yet exist, such as inside loading iframes
1120
- // https://bugs.jquery.com/ticket/4833
1121
- return !rhtml.test( namespace || docElem && docElem.nodeName || "HTML" );
1122
- };
1123
-
1124
1099
  /**
1125
1100
  * Sets document-related variables once based on the current document
1126
- * @param {Element|Object} [doc] An element or document object to use to set the document
1101
+ * @param {Element|Object} [node] An element or document object to use to set the document
1127
1102
  * @returns {Object} Returns the current document
1128
1103
  */
1129
- setDocument = Sizzle.setDocument = function( node ) {
1130
- var hasCompare, subWindow,
1104
+ function setDocument( node ) {
1105
+ var subWindow,
1131
1106
  doc = node ? node.ownerDocument || node : preferredDoc;
1132
1107
 
1133
1108
  // Return early if doc is invalid or already selected
@@ -1141,11 +1116,17 @@ setDocument = Sizzle.setDocument = function( node ) {
1141
1116
 
1142
1117
  // Update global variables
1143
1118
  document = doc;
1144
- docElem = document.documentElement;
1145
- documentIsHTML = !isXML( document );
1119
+ documentElement = document.documentElement;
1120
+ documentIsHTML = !jQuery.isXMLDoc( document );
1121
+
1122
+ // Support: iOS 7 only, IE 9 - 11+
1123
+ // Older browsers didn't support unprefixed `matches`.
1124
+ matches = documentElement.matches ||
1125
+ documentElement.webkitMatchesSelector ||
1126
+ documentElement.msMatchesSelector;
1146
1127
 
1147
1128
  // Support: IE 9 - 11+, Edge 12 - 18+
1148
- // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936)
1129
+ // Accessing iframe documents after unload throws "permission denied" errors (see trac-13936)
1149
1130
  // Support: IE 11+, Edge 17 - 18+
1150
1131
  // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
1151
1132
  // two documents; shallow comparisons work.
@@ -1153,75 +1134,67 @@ setDocument = Sizzle.setDocument = function( node ) {
1153
1134
  if ( preferredDoc != document &&
1154
1135
  ( subWindow = document.defaultView ) && subWindow.top !== subWindow ) {
1155
1136
 
1156
- // Support: IE 11, Edge
1157
- if ( subWindow.addEventListener ) {
1158
- subWindow.addEventListener( "unload", unloadHandler, false );
1159
-
1160
- // Support: IE 9 - 10 only
1161
- } else if ( subWindow.attachEvent ) {
1162
- subWindow.attachEvent( "onunload", unloadHandler );
1163
- }
1137
+ // Support: IE 9 - 11+, Edge 12 - 18+
1138
+ subWindow.addEventListener( "unload", unloadHandler );
1164
1139
  }
1165
1140
 
1166
- // Support: IE 8 - 11+, Edge 12 - 18+, Chrome <=16 - 25 only, Firefox <=3.6 - 31 only,
1167
- // Safari 4 - 5 only, Opera <=11.6 - 12.x only
1168
- // IE/Edge & older browsers don't support the :scope pseudo-class.
1169
- // Support: Safari 6.0 only
1170
- // Safari 6.0 supports :scope but it's an alias of :root there.
1171
- support.scope = assert( function( el ) {
1172
- docElem.appendChild( el ).appendChild( document.createElement( "div" ) );
1173
- return typeof el.querySelectorAll !== "undefined" &&
1174
- !el.querySelectorAll( ":scope fieldset div" ).length;
1141
+ // Support: IE <10
1142
+ // Check if getElementById returns elements by name
1143
+ // The broken getElementById methods don't pick up programmatically-set names,
1144
+ // so use a roundabout getElementsByName test
1145
+ support.getById = assert( function( el ) {
1146
+ documentElement.appendChild( el ).id = jQuery.expando;
1147
+ return !document.getElementsByName ||
1148
+ !document.getElementsByName( jQuery.expando ).length;
1175
1149
  } );
1176
1150
 
1177
- /* Attributes
1178
- ---------------------------------------------------------------------- */
1179
-
1180
- // Support: IE<8
1181
- // Verify that getAttribute really returns attributes and not properties
1182
- // (excepting IE8 booleans)
1183
- support.attributes = assert( function( el ) {
1184
- el.className = "i";
1185
- return !el.getAttribute( "className" );
1151
+ // Support: IE 9 only
1152
+ // Check to see if it's possible to do matchesSelector
1153
+ // on a disconnected node.
1154
+ support.disconnectedMatch = assert( function( el ) {
1155
+ return matches.call( el, "*" );
1186
1156
  } );
1187
1157
 
1188
- /* getElement(s)By*
1189
- ---------------------------------------------------------------------- */
1190
-
1191
- // Check if getElementsByTagName("*") returns only elements
1192
- support.getElementsByTagName = assert( function( el ) {
1193
- el.appendChild( document.createComment( "" ) );
1194
- return !el.getElementsByTagName( "*" ).length;
1158
+ // Support: IE 9 - 11+, Edge 12 - 18+
1159
+ // IE/Edge don't support the :scope pseudo-class.
1160
+ support.scope = assert( function() {
1161
+ return document.querySelectorAll( ":scope" );
1195
1162
  } );
1196
1163
 
1197
- // Support: IE<9
1198
- support.getElementsByClassName = rnative.test( document.getElementsByClassName );
1199
-
1200
- // Support: IE<10
1201
- // Check if getElementById returns elements by name
1202
- // The broken getElementById methods don't pick up programmatically-set names,
1203
- // so use a roundabout getElementsByName test
1204
- support.getById = assert( function( el ) {
1205
- docElem.appendChild( el ).id = expando;
1206
- return !document.getElementsByName || !document.getElementsByName( expando ).length;
1164
+ // Support: Chrome 105 - 111 only, Safari 15.4 - 16.3 only
1165
+ // Make sure the `:has()` argument is parsed unforgivingly.
1166
+ // We include `*` in the test to detect buggy implementations that are
1167
+ // _selectively_ forgiving (specifically when the list includes at least
1168
+ // one valid selector).
1169
+ // Note that we treat complete lack of support for `:has()` as if it were
1170
+ // spec-compliant support, which is fine because use of `:has()` in such
1171
+ // environments will fail in the qSA path and fall back to jQuery traversal
1172
+ // anyway.
1173
+ support.cssHas = assert( function() {
1174
+ try {
1175
+ document.querySelector( ":has(*,:jqfake)" );
1176
+ return false;
1177
+ } catch ( e ) {
1178
+ return true;
1179
+ }
1207
1180
  } );
1208
1181
 
1209
1182
  // ID filter and find
1210
1183
  if ( support.getById ) {
1211
- Expr.filter[ "ID" ] = function( id ) {
1184
+ Expr.filter.ID = function( id ) {
1212
1185
  var attrId = id.replace( runescape, funescape );
1213
1186
  return function( elem ) {
1214
1187
  return elem.getAttribute( "id" ) === attrId;
1215
1188
  };
1216
1189
  };
1217
- Expr.find[ "ID" ] = function( id, context ) {
1190
+ Expr.find.ID = function( id, context ) {
1218
1191
  if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
1219
1192
  var elem = context.getElementById( id );
1220
1193
  return elem ? [ elem ] : [];
1221
1194
  }
1222
1195
  };
1223
1196
  } else {
1224
- Expr.filter[ "ID" ] = function( id ) {
1197
+ Expr.filter.ID = function( id ) {
1225
1198
  var attrId = id.replace( runescape, funescape );
1226
1199
  return function( elem ) {
1227
1200
  var node = typeof elem.getAttributeNode !== "undefined" &&
@@ -1232,7 +1205,7 @@ setDocument = Sizzle.setDocument = function( node ) {
1232
1205
 
1233
1206
  // Support: IE 6 - 7 only
1234
1207
  // getElementById is not reliable as a find shortcut
1235
- Expr.find[ "ID" ] = function( id, context ) {
1208
+ Expr.find.ID = function( id, context ) {
1236
1209
  if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
1237
1210
  var node, i, elems,
1238
1211
  elem = context.getElementById( id );
@@ -1262,40 +1235,18 @@ setDocument = Sizzle.setDocument = function( node ) {
1262
1235
  }
1263
1236
 
1264
1237
  // Tag
1265
- Expr.find[ "TAG" ] = support.getElementsByTagName ?
1266
- function( tag, context ) {
1267
- if ( typeof context.getElementsByTagName !== "undefined" ) {
1268
- return context.getElementsByTagName( tag );
1238
+ Expr.find.TAG = function( tag, context ) {
1239
+ if ( typeof context.getElementsByTagName !== "undefined" ) {
1240
+ return context.getElementsByTagName( tag );
1269
1241
 
1270
- // DocumentFragment nodes don't have gEBTN
1271
- } else if ( support.qsa ) {
1272
- return context.querySelectorAll( tag );
1273
- }
1274
- } :
1275
-
1276
- function( tag, context ) {
1277
- var elem,
1278
- tmp = [],
1279
- i = 0,
1280
-
1281
- // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too
1282
- results = context.getElementsByTagName( tag );
1283
-
1284
- // Filter out possible comments
1285
- if ( tag === "*" ) {
1286
- while ( ( elem = results[ i++ ] ) ) {
1287
- if ( elem.nodeType === 1 ) {
1288
- tmp.push( elem );
1289
- }
1290
- }
1291
-
1292
- return tmp;
1293
- }
1294
- return results;
1295
- };
1242
+ // DocumentFragment nodes don't have gEBTN
1243
+ } else {
1244
+ return context.querySelectorAll( tag );
1245
+ }
1246
+ };
1296
1247
 
1297
1248
  // Class
1298
- Expr.find[ "CLASS" ] = support.getElementsByClassName && function( className, context ) {
1249
+ Expr.find.CLASS = function( className, context ) {
1299
1250
  if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) {
1300
1251
  return context.getElementsByClassName( className );
1301
1252
  }
@@ -1306,177 +1257,94 @@ setDocument = Sizzle.setDocument = function( node ) {
1306
1257
 
1307
1258
  // QSA and matchesSelector support
1308
1259
 
1309
- // matchesSelector(:active) reports false when true (IE9/Opera 11.5)
1310
- rbuggyMatches = [];
1311
-
1312
- // qSa(:focus) reports false when true (Chrome 21)
1313
- // We allow this because of a bug in IE8/9 that throws an error
1314
- // whenever `document.activeElement` is accessed on an iframe
1315
- // So, we allow :focus to pass through QSA all the time to avoid the IE error
1316
- // See https://bugs.jquery.com/ticket/13378
1317
1260
  rbuggyQSA = [];
1318
1261
 
1319
- if ( ( support.qsa = rnative.test( document.querySelectorAll ) ) ) {
1320
-
1321
- // Build QSA regex
1322
- // Regex strategy adopted from Diego Perini
1323
- assert( function( el ) {
1324
-
1325
- var input;
1326
-
1327
- // Select is set to empty string on purpose
1328
- // This is to test IE's treatment of not explicitly
1329
- // setting a boolean content attribute,
1330
- // since its presence should be enough
1331
- // https://bugs.jquery.com/ticket/12359
1332
- docElem.appendChild( el ).innerHTML = "<a id='" + expando + "'></a>" +
1333
- "<select id='" + expando + "-\r\\' msallowcapture=''>" +
1334
- "<option selected=''></option></select>";
1335
-
1336
- // Support: IE8, Opera 11-12.16
1337
- // Nothing should be selected when empty strings follow ^= or $= or *=
1338
- // The test attribute must be unknown in Opera but "safe" for WinRT
1339
- // https://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section
1340
- if ( el.querySelectorAll( "[msallowcapture^='']" ).length ) {
1341
- rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" );
1342
- }
1343
-
1344
- // Support: IE8
1345
- // Boolean attributes and "value" are not treated correctly
1346
- if ( !el.querySelectorAll( "[selected]" ).length ) {
1347
- rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" );
1348
- }
1349
-
1350
- // Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+
1351
- if ( !el.querySelectorAll( "[id~=" + expando + "-]" ).length ) {
1352
- rbuggyQSA.push( "~=" );
1353
- }
1354
-
1355
- // Support: IE 11+, Edge 15 - 18+
1356
- // IE 11/Edge don't find elements on a `[name='']` query in some cases.
1357
- // Adding a temporary attribute to the document before the selection works
1358
- // around the issue.
1359
- // Interestingly, IE 10 & older don't seem to have the issue.
1360
- input = document.createElement( "input" );
1361
- input.setAttribute( "name", "" );
1362
- el.appendChild( input );
1363
- if ( !el.querySelectorAll( "[name='']" ).length ) {
1364
- rbuggyQSA.push( "\\[" + whitespace + "*name" + whitespace + "*=" +
1365
- whitespace + "*(?:''|\"\")" );
1366
- }
1367
-
1368
- // Webkit/Opera - :checked should return selected option elements
1369
- // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
1370
- // IE8 throws error here and will not see later tests
1371
- if ( !el.querySelectorAll( ":checked" ).length ) {
1372
- rbuggyQSA.push( ":checked" );
1373
- }
1374
-
1375
- // Support: Safari 8+, iOS 8+
1376
- // https://bugs.webkit.org/show_bug.cgi?id=136851
1377
- // In-page `selector#id sibling-combinator selector` fails
1378
- if ( !el.querySelectorAll( "a#" + expando + "+*" ).length ) {
1379
- rbuggyQSA.push( ".#.+[+~]" );
1380
- }
1381
-
1382
- // Support: Firefox <=3.6 - 5 only
1383
- // Old Firefox doesn't throw on a badly-escaped identifier.
1384
- el.querySelectorAll( "\\\f" );
1385
- rbuggyQSA.push( "[\\r\\n\\f]" );
1386
- } );
1387
-
1388
- assert( function( el ) {
1389
- el.innerHTML = "<a href='' disabled='disabled'></a>" +
1390
- "<select disabled='disabled'><option/></select>";
1262
+ // Build QSA regex
1263
+ // Regex strategy adopted from Diego Perini
1264
+ assert( function( el ) {
1391
1265
 
1392
- // Support: Windows 8 Native Apps
1393
- // The type and name attributes are restricted during .innerHTML assignment
1394
- var input = document.createElement( "input" );
1395
- input.setAttribute( "type", "hidden" );
1396
- el.appendChild( input ).setAttribute( "name", "D" );
1266
+ var input;
1397
1267
 
1398
- // Support: IE8
1399
- // Enforce case-sensitivity of name attribute
1400
- if ( el.querySelectorAll( "[name=d]" ).length ) {
1401
- rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" );
1402
- }
1268
+ documentElement.appendChild( el ).innerHTML =
1269
+ "<a id='" + expando + "' href='' disabled='disabled'></a>" +
1270
+ "<select id='" + expando + "-\r\\' disabled='disabled'>" +
1271
+ "<option selected=''></option></select>";
1403
1272
 
1404
- // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
1405
- // IE8 throws error here and will not see later tests
1406
- if ( el.querySelectorAll( ":enabled" ).length !== 2 ) {
1407
- rbuggyQSA.push( ":enabled", ":disabled" );
1408
- }
1273
+ // Support: iOS <=7 - 8 only
1274
+ // Boolean attributes and "value" are not treated correctly in some XML documents
1275
+ if ( !el.querySelectorAll( "[selected]" ).length ) {
1276
+ rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" );
1277
+ }
1409
1278
 
1410
- // Support: IE9-11+
1411
- // IE's :disabled selector does not pick up the children of disabled fieldsets
1412
- docElem.appendChild( el ).disabled = true;
1413
- if ( el.querySelectorAll( ":disabled" ).length !== 2 ) {
1414
- rbuggyQSA.push( ":enabled", ":disabled" );
1415
- }
1279
+ // Support: iOS <=7 - 8 only
1280
+ if ( !el.querySelectorAll( "[id~=" + expando + "-]" ).length ) {
1281
+ rbuggyQSA.push( "~=" );
1282
+ }
1416
1283
 
1417
- // Support: Opera 10 - 11 only
1418
- // Opera 10-11 does not throw on post-comma invalid pseudos
1419
- el.querySelectorAll( "*,:x" );
1420
- rbuggyQSA.push( ",.*:" );
1421
- } );
1422
- }
1284
+ // Support: iOS 8 only
1285
+ // https://bugs.webkit.org/show_bug.cgi?id=136851
1286
+ // In-page `selector#id sibling-combinator selector` fails
1287
+ if ( !el.querySelectorAll( "a#" + expando + "+*" ).length ) {
1288
+ rbuggyQSA.push( ".#.+[+~]" );
1289
+ }
1423
1290
 
1424
- if ( ( support.matchesSelector = rnative.test( ( matches = docElem.matches ||
1425
- docElem.webkitMatchesSelector ||
1426
- docElem.mozMatchesSelector ||
1427
- docElem.oMatchesSelector ||
1428
- docElem.msMatchesSelector ) ) ) ) {
1291
+ // Support: Chrome <=105+, Firefox <=104+, Safari <=15.4+
1292
+ // In some of the document kinds, these selectors wouldn't work natively.
1293
+ // This is probably OK but for backwards compatibility we want to maintain
1294
+ // handling them through jQuery traversal in jQuery 3.x.
1295
+ if ( !el.querySelectorAll( ":checked" ).length ) {
1296
+ rbuggyQSA.push( ":checked" );
1297
+ }
1429
1298
 
1430
- assert( function( el ) {
1299
+ // Support: Windows 8 Native Apps
1300
+ // The type and name attributes are restricted during .innerHTML assignment
1301
+ input = document.createElement( "input" );
1302
+ input.setAttribute( "type", "hidden" );
1303
+ el.appendChild( input ).setAttribute( "name", "D" );
1304
+
1305
+ // Support: IE 9 - 11+
1306
+ // IE's :disabled selector does not pick up the children of disabled fieldsets
1307
+ // Support: Chrome <=105+, Firefox <=104+, Safari <=15.4+
1308
+ // In some of the document kinds, these selectors wouldn't work natively.
1309
+ // This is probably OK but for backwards compatibility we want to maintain
1310
+ // handling them through jQuery traversal in jQuery 3.x.
1311
+ documentElement.appendChild( el ).disabled = true;
1312
+ if ( el.querySelectorAll( ":disabled" ).length !== 2 ) {
1313
+ rbuggyQSA.push( ":enabled", ":disabled" );
1314
+ }
1315
+
1316
+ // Support: IE 11+, Edge 15 - 18+
1317
+ // IE 11/Edge don't find elements on a `[name='']` query in some cases.
1318
+ // Adding a temporary attribute to the document before the selection works
1319
+ // around the issue.
1320
+ // Interestingly, IE 10 & older don't seem to have the issue.
1321
+ input = document.createElement( "input" );
1322
+ input.setAttribute( "name", "" );
1323
+ el.appendChild( input );
1324
+ if ( !el.querySelectorAll( "[name='']" ).length ) {
1325
+ rbuggyQSA.push( "\\[" + whitespace + "*name" + whitespace + "*=" +
1326
+ whitespace + "*(?:''|\"\")" );
1327
+ }
1328
+ } );
1431
1329
 
1432
- // Check to see if it's possible to do matchesSelector
1433
- // on a disconnected node (IE 9)
1434
- support.disconnectedMatch = matches.call( el, "*" );
1330
+ if ( !support.cssHas ) {
1435
1331
 
1436
- // This should fail with an exception
1437
- // Gecko does not error, returns false instead
1438
- matches.call( el, "[s!='']:x" );
1439
- rbuggyMatches.push( "!=", pseudos );
1440
- } );
1332
+ // Support: Chrome 105 - 110+, Safari 15.4 - 16.3+
1333
+ // Our regular `try-catch` mechanism fails to detect natively-unsupported
1334
+ // pseudo-classes inside `:has()` (such as `:has(:contains("Foo"))`)
1335
+ // in browsers that parse the `:has()` argument as a forgiving selector list.
1336
+ // https://drafts.csswg.org/selectors/#relational now requires the argument
1337
+ // to be parsed unforgivingly, but browsers have not yet fully adjusted.
1338
+ rbuggyQSA.push( ":has" );
1441
1339
  }
1442
1340
 
1443
1341
  rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join( "|" ) );
1444
- rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join( "|" ) );
1445
-
1446
- /* Contains
1447
- ---------------------------------------------------------------------- */
1448
- hasCompare = rnative.test( docElem.compareDocumentPosition );
1449
-
1450
- // Element contains another
1451
- // Purposefully self-exclusive
1452
- // As in, an element does not contain itself
1453
- contains = hasCompare || rnative.test( docElem.contains ) ?
1454
- function( a, b ) {
1455
- var adown = a.nodeType === 9 ? a.documentElement : a,
1456
- bup = b && b.parentNode;
1457
- return a === bup || !!( bup && bup.nodeType === 1 && (
1458
- adown.contains ?
1459
- adown.contains( bup ) :
1460
- a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
1461
- ) );
1462
- } :
1463
- function( a, b ) {
1464
- if ( b ) {
1465
- while ( ( b = b.parentNode ) ) {
1466
- if ( b === a ) {
1467
- return true;
1468
- }
1469
- }
1470
- }
1471
- return false;
1472
- };
1473
1342
 
1474
1343
  /* Sorting
1475
1344
  ---------------------------------------------------------------------- */
1476
1345
 
1477
1346
  // Document order sorting
1478
- sortOrder = hasCompare ?
1479
- function( a, b ) {
1347
+ sortOrder = function( a, b ) {
1480
1348
 
1481
1349
  // Flag for duplicate removal
1482
1350
  if ( a === b ) {
@@ -1510,8 +1378,8 @@ setDocument = Sizzle.setDocument = function( node ) {
1510
1378
  // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
1511
1379
  // two documents; shallow comparisons work.
1512
1380
  // eslint-disable-next-line eqeqeq
1513
- if ( a == document || a.ownerDocument == preferredDoc &&
1514
- contains( preferredDoc, a ) ) {
1381
+ if ( a === document || a.ownerDocument == preferredDoc &&
1382
+ find.contains( preferredDoc, a ) ) {
1515
1383
  return -1;
1516
1384
  }
1517
1385
 
@@ -1519,100 +1387,33 @@ setDocument = Sizzle.setDocument = function( node ) {
1519
1387
  // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
1520
1388
  // two documents; shallow comparisons work.
1521
1389
  // eslint-disable-next-line eqeqeq
1522
- if ( b == document || b.ownerDocument == preferredDoc &&
1523
- contains( preferredDoc, b ) ) {
1390
+ if ( b === document || b.ownerDocument == preferredDoc &&
1391
+ find.contains( preferredDoc, b ) ) {
1524
1392
  return 1;
1525
1393
  }
1526
1394
 
1527
1395
  // Maintain original order
1528
1396
  return sortInput ?
1529
- ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
1397
+ ( indexOf.call( sortInput, a ) - indexOf.call( sortInput, b ) ) :
1530
1398
  0;
1531
1399
  }
1532
1400
 
1533
1401
  return compare & 4 ? -1 : 1;
1534
- } :
1535
- function( a, b ) {
1536
-
1537
- // Exit early if the nodes are identical
1538
- if ( a === b ) {
1539
- hasDuplicate = true;
1540
- return 0;
1541
- }
1542
-
1543
- var cur,
1544
- i = 0,
1545
- aup = a.parentNode,
1546
- bup = b.parentNode,
1547
- ap = [ a ],
1548
- bp = [ b ];
1549
-
1550
- // Parentless nodes are either documents or disconnected
1551
- if ( !aup || !bup ) {
1552
-
1553
- // Support: IE 11+, Edge 17 - 18+
1554
- // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
1555
- // two documents; shallow comparisons work.
1556
- /* eslint-disable eqeqeq */
1557
- return a == document ? -1 :
1558
- b == document ? 1 :
1559
- /* eslint-enable eqeqeq */
1560
- aup ? -1 :
1561
- bup ? 1 :
1562
- sortInput ?
1563
- ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
1564
- 0;
1565
-
1566
- // If the nodes are siblings, we can do a quick check
1567
- } else if ( aup === bup ) {
1568
- return siblingCheck( a, b );
1569
- }
1570
-
1571
- // Otherwise we need full lists of their ancestors for comparison
1572
- cur = a;
1573
- while ( ( cur = cur.parentNode ) ) {
1574
- ap.unshift( cur );
1575
- }
1576
- cur = b;
1577
- while ( ( cur = cur.parentNode ) ) {
1578
- bp.unshift( cur );
1579
- }
1580
-
1581
- // Walk down the tree looking for a discrepancy
1582
- while ( ap[ i ] === bp[ i ] ) {
1583
- i++;
1584
- }
1585
-
1586
- return i ?
1587
-
1588
- // Do a sibling check if the nodes have a common ancestor
1589
- siblingCheck( ap[ i ], bp[ i ] ) :
1590
-
1591
- // Otherwise nodes in our document sort first
1592
- // Support: IE 11+, Edge 17 - 18+
1593
- // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
1594
- // two documents; shallow comparisons work.
1595
- /* eslint-disable eqeqeq */
1596
- ap[ i ] == preferredDoc ? -1 :
1597
- bp[ i ] == preferredDoc ? 1 :
1598
- /* eslint-enable eqeqeq */
1599
- 0;
1600
1402
  };
1601
1403
 
1602
1404
  return document;
1603
- };
1405
+ }
1604
1406
 
1605
- Sizzle.matches = function( expr, elements ) {
1606
- return Sizzle( expr, null, null, elements );
1407
+ find.matches = function( expr, elements ) {
1408
+ return find( expr, null, null, elements );
1607
1409
  };
1608
1410
 
1609
- Sizzle.matchesSelector = function( elem, expr ) {
1411
+ find.matchesSelector = function( elem, expr ) {
1610
1412
  setDocument( elem );
1611
1413
 
1612
- if ( support.matchesSelector && documentIsHTML &&
1414
+ if ( documentIsHTML &&
1613
1415
  !nonnativeSelectorCache[ expr + " " ] &&
1614
- ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) &&
1615
- ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) {
1416
+ ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) {
1616
1417
 
1617
1418
  try {
1618
1419
  var ret = matches.call( elem, expr );
@@ -1620,9 +1421,9 @@ Sizzle.matchesSelector = function( elem, expr ) {
1620
1421
  // IE 9's matchesSelector returns false on disconnected nodes
1621
1422
  if ( ret || support.disconnectedMatch ||
1622
1423
 
1623
- // As well, disconnected nodes are said to be in a document
1624
- // fragment in IE 9
1625
- elem.document && elem.document.nodeType !== 11 ) {
1424
+ // As well, disconnected nodes are said to be in a document
1425
+ // fragment in IE 9
1426
+ elem.document && elem.document.nodeType !== 11 ) {
1626
1427
  return ret;
1627
1428
  }
1628
1429
  } catch ( e ) {
@@ -1630,10 +1431,10 @@ Sizzle.matchesSelector = function( elem, expr ) {
1630
1431
  }
1631
1432
  }
1632
1433
 
1633
- return Sizzle( expr, document, null, [ elem ] ).length > 0;
1434
+ return find( expr, document, null, [ elem ] ).length > 0;
1634
1435
  };
1635
1436
 
1636
- Sizzle.contains = function( context, elem ) {
1437
+ find.contains = function( context, elem ) {
1637
1438
 
1638
1439
  // Set document vars if needed
1639
1440
  // Support: IE 11+, Edge 17 - 18+
@@ -1643,10 +1444,11 @@ Sizzle.contains = function( context, elem ) {
1643
1444
  if ( ( context.ownerDocument || context ) != document ) {
1644
1445
  setDocument( context );
1645
1446
  }
1646
- return contains( context, elem );
1447
+ return jQuery.contains( context, elem );
1647
1448
  };
1648
1449
 
1649
- Sizzle.attr = function( elem, name ) {
1450
+
1451
+ find.attr = function( elem, name ) {
1650
1452
 
1651
1453
  // Set document vars if needed
1652
1454
  // Support: IE 11+, Edge 17 - 18+
@@ -1659,25 +1461,19 @@ Sizzle.attr = function( elem, name ) {
1659
1461
 
1660
1462
  var fn = Expr.attrHandle[ name.toLowerCase() ],
1661
1463
 
1662
- // Don't get fooled by Object.prototype properties (jQuery #13807)
1464
+ // Don't get fooled by Object.prototype properties (see trac-13807)
1663
1465
  val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ?
1664
1466
  fn( elem, name, !documentIsHTML ) :
1665
1467
  undefined;
1666
1468
 
1667
- return val !== undefined ?
1668
- val :
1669
- support.attributes || !documentIsHTML ?
1670
- elem.getAttribute( name ) :
1671
- ( val = elem.getAttributeNode( name ) ) && val.specified ?
1672
- val.value :
1673
- null;
1674
- };
1469
+ if ( val !== undefined ) {
1470
+ return val;
1471
+ }
1675
1472
 
1676
- Sizzle.escape = function( sel ) {
1677
- return ( sel + "" ).replace( rcssescape, fcssescape );
1473
+ return elem.getAttribute( name );
1678
1474
  };
1679
1475
 
1680
- Sizzle.error = function( msg ) {
1476
+ find.error = function( msg ) {
1681
1477
  throw new Error( "Syntax error, unrecognized expression: " + msg );
1682
1478
  };
1683
1479
 
@@ -1685,16 +1481,20 @@ Sizzle.error = function( msg ) {
1685
1481
  * Document sorting and removing duplicates
1686
1482
  * @param {ArrayLike} results
1687
1483
  */
1688
- Sizzle.uniqueSort = function( results ) {
1484
+ jQuery.uniqueSort = function( results ) {
1689
1485
  var elem,
1690
1486
  duplicates = [],
1691
1487
  j = 0,
1692
1488
  i = 0;
1693
1489
 
1694
1490
  // Unless we *know* we can detect duplicates, assume their presence
1695
- hasDuplicate = !support.detectDuplicates;
1696
- sortInput = !support.sortStable && results.slice( 0 );
1697
- results.sort( sortOrder );
1491
+ //
1492
+ // Support: Android <=4.0+
1493
+ // Testing for detecting duplicates is unpredictable so instead assume we can't
1494
+ // depend on duplicate detection in all browsers without a stable sort.
1495
+ hasDuplicate = !support.sortStable;
1496
+ sortInput = !support.sortStable && slice.call( results, 0 );
1497
+ sort.call( results, sortOrder );
1698
1498
 
1699
1499
  if ( hasDuplicate ) {
1700
1500
  while ( ( elem = results[ i++ ] ) ) {
@@ -1703,7 +1503,7 @@ Sizzle.uniqueSort = function( results ) {
1703
1503
  }
1704
1504
  }
1705
1505
  while ( j-- ) {
1706
- results.splice( duplicates[ j ], 1 );
1506
+ splice.call( results, duplicates[ j ], 1 );
1707
1507
  }
1708
1508
  }
1709
1509
 
@@ -1714,47 +1514,11 @@ Sizzle.uniqueSort = function( results ) {
1714
1514
  return results;
1715
1515
  };
1716
1516
 
1717
- /**
1718
- * Utility function for retrieving the text value of an array of DOM nodes
1719
- * @param {Array|Element} elem
1720
- */
1721
- getText = Sizzle.getText = function( elem ) {
1722
- var node,
1723
- ret = "",
1724
- i = 0,
1725
- nodeType = elem.nodeType;
1726
-
1727
- if ( !nodeType ) {
1728
-
1729
- // If no nodeType, this is expected to be an array
1730
- while ( ( node = elem[ i++ ] ) ) {
1731
-
1732
- // Do not traverse comment nodes
1733
- ret += getText( node );
1734
- }
1735
- } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
1736
-
1737
- // Use textContent for elements
1738
- // innerText usage removed for consistency of new lines (jQuery #11153)
1739
- if ( typeof elem.textContent === "string" ) {
1740
- return elem.textContent;
1741
- } else {
1742
-
1743
- // Traverse its children
1744
- for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
1745
- ret += getText( elem );
1746
- }
1747
- }
1748
- } else if ( nodeType === 3 || nodeType === 4 ) {
1749
- return elem.nodeValue;
1750
- }
1751
-
1752
- // Do not include comment or processing instruction nodes
1753
-
1754
- return ret;
1517
+ jQuery.fn.uniqueSort = function() {
1518
+ return this.pushStack( jQuery.uniqueSort( slice.apply( this ) ) );
1755
1519
  };
1756
1520
 
1757
- Expr = Sizzle.selectors = {
1521
+ Expr = jQuery.expr = {
1758
1522
 
1759
1523
  // Can be adjusted by the user
1760
1524
  cacheLength: 50,
@@ -1775,12 +1539,12 @@ Expr = Sizzle.selectors = {
1775
1539
  },
1776
1540
 
1777
1541
  preFilter: {
1778
- "ATTR": function( match ) {
1542
+ ATTR: function( match ) {
1779
1543
  match[ 1 ] = match[ 1 ].replace( runescape, funescape );
1780
1544
 
1781
1545
  // Move the given value to match[3] whether quoted or unquoted
1782
- match[ 3 ] = ( match[ 3 ] || match[ 4 ] ||
1783
- match[ 5 ] || "" ).replace( runescape, funescape );
1546
+ match[ 3 ] = ( match[ 3 ] || match[ 4 ] || match[ 5 ] || "" )
1547
+ .replace( runescape, funescape );
1784
1548
 
1785
1549
  if ( match[ 2 ] === "~=" ) {
1786
1550
  match[ 3 ] = " " + match[ 3 ] + " ";
@@ -1789,7 +1553,7 @@ Expr = Sizzle.selectors = {
1789
1553
  return match.slice( 0, 4 );
1790
1554
  },
1791
1555
 
1792
- "CHILD": function( match ) {
1556
+ CHILD: function( match ) {
1793
1557
 
1794
1558
  /* matches from matchExpr["CHILD"]
1795
1559
  1 type (only|nth|...)
@@ -1807,29 +1571,30 @@ Expr = Sizzle.selectors = {
1807
1571
 
1808
1572
  // nth-* requires argument
1809
1573
  if ( !match[ 3 ] ) {
1810
- Sizzle.error( match[ 0 ] );
1574
+ find.error( match[ 0 ] );
1811
1575
  }
1812
1576
 
1813
1577
  // numeric x and y parameters for Expr.filter.CHILD
1814
1578
  // remember that false/true cast respectively to 0/1
1815
1579
  match[ 4 ] = +( match[ 4 ] ?
1816
1580
  match[ 5 ] + ( match[ 6 ] || 1 ) :
1817
- 2 * ( match[ 3 ] === "even" || match[ 3 ] === "odd" ) );
1581
+ 2 * ( match[ 3 ] === "even" || match[ 3 ] === "odd" )
1582
+ );
1818
1583
  match[ 5 ] = +( ( match[ 7 ] + match[ 8 ] ) || match[ 3 ] === "odd" );
1819
1584
 
1820
- // other types prohibit arguments
1585
+ // other types prohibit arguments
1821
1586
  } else if ( match[ 3 ] ) {
1822
- Sizzle.error( match[ 0 ] );
1587
+ find.error( match[ 0 ] );
1823
1588
  }
1824
1589
 
1825
1590
  return match;
1826
1591
  },
1827
1592
 
1828
- "PSEUDO": function( match ) {
1593
+ PSEUDO: function( match ) {
1829
1594
  var excess,
1830
1595
  unquoted = !match[ 6 ] && match[ 2 ];
1831
1596
 
1832
- if ( matchExpr[ "CHILD" ].test( match[ 0 ] ) ) {
1597
+ if ( matchExpr.CHILD.test( match[ 0 ] ) ) {
1833
1598
  return null;
1834
1599
  }
1835
1600
 
@@ -1858,36 +1623,36 @@ Expr = Sizzle.selectors = {
1858
1623
 
1859
1624
  filter: {
1860
1625
 
1861
- "TAG": function( nodeNameSelector ) {
1862
- var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase();
1626
+ TAG: function( nodeNameSelector ) {
1627
+ var expectedNodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase();
1863
1628
  return nodeNameSelector === "*" ?
1864
1629
  function() {
1865
1630
  return true;
1866
1631
  } :
1867
1632
  function( elem ) {
1868
- return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
1633
+ return nodeName( elem, expectedNodeName );
1869
1634
  };
1870
1635
  },
1871
1636
 
1872
- "CLASS": function( className ) {
1637
+ CLASS: function( className ) {
1873
1638
  var pattern = classCache[ className + " " ];
1874
1639
 
1875
1640
  return pattern ||
1876
- ( pattern = new RegExp( "(^|" + whitespace +
1877
- ")" + className + "(" + whitespace + "|$)" ) ) && classCache(
1878
- className, function( elem ) {
1879
- return pattern.test(
1880
- typeof elem.className === "string" && elem.className ||
1881
- typeof elem.getAttribute !== "undefined" &&
1882
- elem.getAttribute( "class" ) ||
1883
- ""
1884
- );
1641
+ ( pattern = new RegExp( "(^|" + whitespace + ")" + className +
1642
+ "(" + whitespace + "|$)" ) ) &&
1643
+ classCache( className, function( elem ) {
1644
+ return pattern.test(
1645
+ typeof elem.className === "string" && elem.className ||
1646
+ typeof elem.getAttribute !== "undefined" &&
1647
+ elem.getAttribute( "class" ) ||
1648
+ ""
1649
+ );
1885
1650
  } );
1886
1651
  },
1887
1652
 
1888
- "ATTR": function( name, operator, check ) {
1653
+ ATTR: function( name, operator, check ) {
1889
1654
  return function( elem ) {
1890
- var result = Sizzle.attr( elem, name );
1655
+ var result = find.attr( elem, name );
1891
1656
 
1892
1657
  if ( result == null ) {
1893
1658
  return operator === "!=";
@@ -1898,22 +1663,34 @@ Expr = Sizzle.selectors = {
1898
1663
 
1899
1664
  result += "";
1900
1665
 
1901
- /* eslint-disable max-len */
1902
-
1903
- return operator === "=" ? result === check :
1904
- operator === "!=" ? result !== check :
1905
- operator === "^=" ? check && result.indexOf( check ) === 0 :
1906
- operator === "*=" ? check && result.indexOf( check ) > -1 :
1907
- operator === "$=" ? check && result.slice( -check.length ) === check :
1908
- operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 :
1909
- operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" :
1910
- false;
1911
- /* eslint-enable max-len */
1666
+ if ( operator === "=" ) {
1667
+ return result === check;
1668
+ }
1669
+ if ( operator === "!=" ) {
1670
+ return result !== check;
1671
+ }
1672
+ if ( operator === "^=" ) {
1673
+ return check && result.indexOf( check ) === 0;
1674
+ }
1675
+ if ( operator === "*=" ) {
1676
+ return check && result.indexOf( check ) > -1;
1677
+ }
1678
+ if ( operator === "$=" ) {
1679
+ return check && result.slice( -check.length ) === check;
1680
+ }
1681
+ if ( operator === "~=" ) {
1682
+ return ( " " + result.replace( rwhitespace, " " ) + " " )
1683
+ .indexOf( check ) > -1;
1684
+ }
1685
+ if ( operator === "|=" ) {
1686
+ return result === check || result.slice( 0, check.length + 1 ) === check + "-";
1687
+ }
1912
1688
 
1689
+ return false;
1913
1690
  };
1914
1691
  },
1915
1692
 
1916
- "CHILD": function( type, what, _argument, first, last ) {
1693
+ CHILD: function( type, what, _argument, first, last ) {
1917
1694
  var simple = type.slice( 0, 3 ) !== "nth",
1918
1695
  forward = type.slice( -4 ) !== "last",
1919
1696
  ofType = what === "of-type";
@@ -1926,7 +1703,7 @@ Expr = Sizzle.selectors = {
1926
1703
  } :
1927
1704
 
1928
1705
  function( elem, _context, xml ) {
1929
- var cache, uniqueCache, outerCache, node, nodeIndex, start,
1706
+ var cache, outerCache, node, nodeIndex, start,
1930
1707
  dir = simple !== forward ? "nextSibling" : "previousSibling",
1931
1708
  parent = elem.parentNode,
1932
1709
  name = ofType && elem.nodeName.toLowerCase(),
@@ -1941,7 +1718,7 @@ Expr = Sizzle.selectors = {
1941
1718
  node = elem;
1942
1719
  while ( ( node = node[ dir ] ) ) {
1943
1720
  if ( ofType ?
1944
- node.nodeName.toLowerCase() === name :
1721
+ nodeName( node, name ) :
1945
1722
  node.nodeType === 1 ) {
1946
1723
 
1947
1724
  return false;
@@ -1960,17 +1737,8 @@ Expr = Sizzle.selectors = {
1960
1737
  if ( forward && useCache ) {
1961
1738
 
1962
1739
  // Seek `elem` from a previously-cached index
1963
-
1964
- // ...in a gzip-friendly way
1965
- node = parent;
1966
- outerCache = node[ expando ] || ( node[ expando ] = {} );
1967
-
1968
- // Support: IE <9 only
1969
- // Defend against cloned attroperties (jQuery gh-1709)
1970
- uniqueCache = outerCache[ node.uniqueID ] ||
1971
- ( outerCache[ node.uniqueID ] = {} );
1972
-
1973
- cache = uniqueCache[ type ] || [];
1740
+ outerCache = parent[ expando ] || ( parent[ expando ] = {} );
1741
+ cache = outerCache[ type ] || [];
1974
1742
  nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
1975
1743
  diff = nodeIndex && cache[ 2 ];
1976
1744
  node = nodeIndex && parent.childNodes[ nodeIndex ];
@@ -1982,7 +1750,7 @@ Expr = Sizzle.selectors = {
1982
1750
 
1983
1751
  // When found, cache indexes on `parent` and break
1984
1752
  if ( node.nodeType === 1 && ++diff && node === elem ) {
1985
- uniqueCache[ type ] = [ dirruns, nodeIndex, diff ];
1753
+ outerCache[ type ] = [ dirruns, nodeIndex, diff ];
1986
1754
  break;
1987
1755
  }
1988
1756
  }
@@ -1991,17 +1759,8 @@ Expr = Sizzle.selectors = {
1991
1759
 
1992
1760
  // Use previously-cached element index if available
1993
1761
  if ( useCache ) {
1994
-
1995
- // ...in a gzip-friendly way
1996
- node = elem;
1997
- outerCache = node[ expando ] || ( node[ expando ] = {} );
1998
-
1999
- // Support: IE <9 only
2000
- // Defend against cloned attroperties (jQuery gh-1709)
2001
- uniqueCache = outerCache[ node.uniqueID ] ||
2002
- ( outerCache[ node.uniqueID ] = {} );
2003
-
2004
- cache = uniqueCache[ type ] || [];
1762
+ outerCache = elem[ expando ] || ( elem[ expando ] = {} );
1763
+ cache = outerCache[ type ] || [];
2005
1764
  nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
2006
1765
  diff = nodeIndex;
2007
1766
  }
@@ -2015,7 +1774,7 @@ Expr = Sizzle.selectors = {
2015
1774
  ( diff = nodeIndex = 0 ) || start.pop() ) ) {
2016
1775
 
2017
1776
  if ( ( ofType ?
2018
- node.nodeName.toLowerCase() === name :
1777
+ nodeName( node, name ) :
2019
1778
  node.nodeType === 1 ) &&
2020
1779
  ++diff ) {
2021
1780
 
@@ -2023,13 +1782,7 @@ Expr = Sizzle.selectors = {
2023
1782
  if ( useCache ) {
2024
1783
  outerCache = node[ expando ] ||
2025
1784
  ( node[ expando ] = {} );
2026
-
2027
- // Support: IE <9 only
2028
- // Defend against cloned attroperties (jQuery gh-1709)
2029
- uniqueCache = outerCache[ node.uniqueID ] ||
2030
- ( outerCache[ node.uniqueID ] = {} );
2031
-
2032
- uniqueCache[ type ] = [ dirruns, diff ];
1785
+ outerCache[ type ] = [ dirruns, diff ];
2033
1786
  }
2034
1787
 
2035
1788
  if ( node === elem ) {
@@ -2047,19 +1800,19 @@ Expr = Sizzle.selectors = {
2047
1800
  };
2048
1801
  },
2049
1802
 
2050
- "PSEUDO": function( pseudo, argument ) {
1803
+ PSEUDO: function( pseudo, argument ) {
2051
1804
 
2052
1805
  // pseudo-class names are case-insensitive
2053
- // http://www.w3.org/TR/selectors/#pseudo-classes
1806
+ // https://www.w3.org/TR/selectors/#pseudo-classes
2054
1807
  // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
2055
1808
  // Remember that setFilters inherits from pseudos
2056
1809
  var args,
2057
1810
  fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||
2058
- Sizzle.error( "unsupported pseudo: " + pseudo );
1811
+ find.error( "unsupported pseudo: " + pseudo );
2059
1812
 
2060
1813
  // The user may use createPseudo to indicate that
2061
1814
  // arguments are needed to create the filter function
2062
- // just as Sizzle does
1815
+ // just as jQuery does
2063
1816
  if ( fn[ expando ] ) {
2064
1817
  return fn( argument );
2065
1818
  }
@@ -2073,7 +1826,7 @@ Expr = Sizzle.selectors = {
2073
1826
  matched = fn( seed, argument ),
2074
1827
  i = matched.length;
2075
1828
  while ( i-- ) {
2076
- idx = indexOf( seed, matched[ i ] );
1829
+ idx = indexOf.call( seed, matched[ i ] );
2077
1830
  seed[ idx ] = !( matches[ idx ] = matched[ i ] );
2078
1831
  }
2079
1832
  } ) :
@@ -2089,14 +1842,14 @@ Expr = Sizzle.selectors = {
2089
1842
  pseudos: {
2090
1843
 
2091
1844
  // Potentially complex pseudos
2092
- "not": markFunction( function( selector ) {
1845
+ not: markFunction( function( selector ) {
2093
1846
 
2094
1847
  // Trim the selector passed to compile
2095
1848
  // to avoid treating leading and trailing
2096
1849
  // spaces as combinators
2097
1850
  var input = [],
2098
1851
  results = [],
2099
- matcher = compile( selector.replace( rtrim, "$1" ) );
1852
+ matcher = compile( selector.replace( rtrimCSS, "$1" ) );
2100
1853
 
2101
1854
  return matcher[ expando ] ?
2102
1855
  markFunction( function( seed, matches, _context, xml ) {
@@ -2115,22 +1868,23 @@ Expr = Sizzle.selectors = {
2115
1868
  input[ 0 ] = elem;
2116
1869
  matcher( input, null, xml, results );
2117
1870
 
2118
- // Don't keep the element (issue #299)
1871
+ // Don't keep the element
1872
+ // (see https://github.com/jquery/sizzle/issues/299)
2119
1873
  input[ 0 ] = null;
2120
1874
  return !results.pop();
2121
1875
  };
2122
1876
  } ),
2123
1877
 
2124
- "has": markFunction( function( selector ) {
1878
+ has: markFunction( function( selector ) {
2125
1879
  return function( elem ) {
2126
- return Sizzle( selector, elem ).length > 0;
1880
+ return find( selector, elem ).length > 0;
2127
1881
  };
2128
1882
  } ),
2129
1883
 
2130
- "contains": markFunction( function( text ) {
1884
+ contains: markFunction( function( text ) {
2131
1885
  text = text.replace( runescape, funescape );
2132
1886
  return function( elem ) {
2133
- return ( elem.textContent || getText( elem ) ).indexOf( text ) > -1;
1887
+ return ( elem.textContent || jQuery.text( elem ) ).indexOf( text ) > -1;
2134
1888
  };
2135
1889
  } ),
2136
1890
 
@@ -2140,12 +1894,12 @@ Expr = Sizzle.selectors = {
2140
1894
  // or beginning with the identifier C immediately followed by "-".
2141
1895
  // The matching of C against the element's language value is performed case-insensitively.
2142
1896
  // The identifier C does not have to be a valid language name."
2143
- // http://www.w3.org/TR/selectors/#lang-pseudo
2144
- "lang": markFunction( function( lang ) {
1897
+ // https://www.w3.org/TR/selectors/#lang-pseudo
1898
+ lang: markFunction( function( lang ) {
2145
1899
 
2146
1900
  // lang value must be a valid identifier
2147
1901
  if ( !ridentifier.test( lang || "" ) ) {
2148
- Sizzle.error( "unsupported lang: " + lang );
1902
+ find.error( "unsupported lang: " + lang );
2149
1903
  }
2150
1904
  lang = lang.replace( runescape, funescape ).toLowerCase();
2151
1905
  return function( elem ) {
@@ -2164,38 +1918,39 @@ Expr = Sizzle.selectors = {
2164
1918
  } ),
2165
1919
 
2166
1920
  // Miscellaneous
2167
- "target": function( elem ) {
1921
+ target: function( elem ) {
2168
1922
  var hash = window.location && window.location.hash;
2169
1923
  return hash && hash.slice( 1 ) === elem.id;
2170
1924
  },
2171
1925
 
2172
- "root": function( elem ) {
2173
- return elem === docElem;
1926
+ root: function( elem ) {
1927
+ return elem === documentElement;
2174
1928
  },
2175
1929
 
2176
- "focus": function( elem ) {
2177
- return elem === document.activeElement &&
2178
- ( !document.hasFocus || document.hasFocus() ) &&
1930
+ focus: function( elem ) {
1931
+ return elem === safeActiveElement() &&
1932
+ document.hasFocus() &&
2179
1933
  !!( elem.type || elem.href || ~elem.tabIndex );
2180
1934
  },
2181
1935
 
2182
1936
  // Boolean properties
2183
- "enabled": createDisabledPseudo( false ),
2184
- "disabled": createDisabledPseudo( true ),
1937
+ enabled: createDisabledPseudo( false ),
1938
+ disabled: createDisabledPseudo( true ),
2185
1939
 
2186
- "checked": function( elem ) {
1940
+ checked: function( elem ) {
2187
1941
 
2188
1942
  // In CSS3, :checked should return both checked and selected elements
2189
- // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
2190
- var nodeName = elem.nodeName.toLowerCase();
2191
- return ( nodeName === "input" && !!elem.checked ) ||
2192
- ( nodeName === "option" && !!elem.selected );
1943
+ // https://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
1944
+ return ( nodeName( elem, "input" ) && !!elem.checked ) ||
1945
+ ( nodeName( elem, "option" ) && !!elem.selected );
2193
1946
  },
2194
1947
 
2195
- "selected": function( elem ) {
1948
+ selected: function( elem ) {
2196
1949
 
2197
- // Accessing this property makes selected-by-default
2198
- // options in Safari work properly
1950
+ // Support: IE <=11+
1951
+ // Accessing the selectedIndex property
1952
+ // forces the browser to treat the default option as
1953
+ // selected when in an optgroup.
2199
1954
  if ( elem.parentNode ) {
2200
1955
  // eslint-disable-next-line no-unused-expressions
2201
1956
  elem.parentNode.selectedIndex;
@@ -2205,9 +1960,9 @@ Expr = Sizzle.selectors = {
2205
1960
  },
2206
1961
 
2207
1962
  // Contents
2208
- "empty": function( elem ) {
1963
+ empty: function( elem ) {
2209
1964
 
2210
- // http://www.w3.org/TR/selectors/#empty-pseudo
1965
+ // https://www.w3.org/TR/selectors/#empty-pseudo
2211
1966
  // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5),
2212
1967
  // but not by others (comment: 8; processing instruction: 7; etc.)
2213
1968
  // nodeType < 6 works because attributes (2) do not appear as children
@@ -2219,49 +1974,49 @@ Expr = Sizzle.selectors = {
2219
1974
  return true;
2220
1975
  },
2221
1976
 
2222
- "parent": function( elem ) {
2223
- return !Expr.pseudos[ "empty" ]( elem );
1977
+ parent: function( elem ) {
1978
+ return !Expr.pseudos.empty( elem );
2224
1979
  },
2225
1980
 
2226
1981
  // Element/input types
2227
- "header": function( elem ) {
1982
+ header: function( elem ) {
2228
1983
  return rheader.test( elem.nodeName );
2229
1984
  },
2230
1985
 
2231
- "input": function( elem ) {
1986
+ input: function( elem ) {
2232
1987
  return rinputs.test( elem.nodeName );
2233
1988
  },
2234
1989
 
2235
- "button": function( elem ) {
2236
- var name = elem.nodeName.toLowerCase();
2237
- return name === "input" && elem.type === "button" || name === "button";
1990
+ button: function( elem ) {
1991
+ return nodeName( elem, "input" ) && elem.type === "button" ||
1992
+ nodeName( elem, "button" );
2238
1993
  },
2239
1994
 
2240
- "text": function( elem ) {
1995
+ text: function( elem ) {
2241
1996
  var attr;
2242
- return elem.nodeName.toLowerCase() === "input" &&
2243
- elem.type === "text" &&
1997
+ return nodeName( elem, "input" ) && elem.type === "text" &&
2244
1998
 
2245
- // Support: IE<8
2246
- // New HTML5 attribute values (e.g., "search") appear with elem.type === "text"
1999
+ // Support: IE <10 only
2000
+ // New HTML5 attribute values (e.g., "search") appear
2001
+ // with elem.type === "text"
2247
2002
  ( ( attr = elem.getAttribute( "type" ) ) == null ||
2248
2003
  attr.toLowerCase() === "text" );
2249
2004
  },
2250
2005
 
2251
2006
  // Position-in-collection
2252
- "first": createPositionalPseudo( function() {
2007
+ first: createPositionalPseudo( function() {
2253
2008
  return [ 0 ];
2254
2009
  } ),
2255
2010
 
2256
- "last": createPositionalPseudo( function( _matchIndexes, length ) {
2011
+ last: createPositionalPseudo( function( _matchIndexes, length ) {
2257
2012
  return [ length - 1 ];
2258
2013
  } ),
2259
2014
 
2260
- "eq": createPositionalPseudo( function( _matchIndexes, length, argument ) {
2015
+ eq: createPositionalPseudo( function( _matchIndexes, length, argument ) {
2261
2016
  return [ argument < 0 ? argument + length : argument ];
2262
2017
  } ),
2263
2018
 
2264
- "even": createPositionalPseudo( function( matchIndexes, length ) {
2019
+ even: createPositionalPseudo( function( matchIndexes, length ) {
2265
2020
  var i = 0;
2266
2021
  for ( ; i < length; i += 2 ) {
2267
2022
  matchIndexes.push( i );
@@ -2269,7 +2024,7 @@ Expr = Sizzle.selectors = {
2269
2024
  return matchIndexes;
2270
2025
  } ),
2271
2026
 
2272
- "odd": createPositionalPseudo( function( matchIndexes, length ) {
2027
+ odd: createPositionalPseudo( function( matchIndexes, length ) {
2273
2028
  var i = 1;
2274
2029
  for ( ; i < length; i += 2 ) {
2275
2030
  matchIndexes.push( i );
@@ -2277,19 +2032,24 @@ Expr = Sizzle.selectors = {
2277
2032
  return matchIndexes;
2278
2033
  } ),
2279
2034
 
2280
- "lt": createPositionalPseudo( function( matchIndexes, length, argument ) {
2281
- var i = argument < 0 ?
2282
- argument + length :
2283
- argument > length ?
2284
- length :
2285
- argument;
2035
+ lt: createPositionalPseudo( function( matchIndexes, length, argument ) {
2036
+ var i;
2037
+
2038
+ if ( argument < 0 ) {
2039
+ i = argument + length;
2040
+ } else if ( argument > length ) {
2041
+ i = length;
2042
+ } else {
2043
+ i = argument;
2044
+ }
2045
+
2286
2046
  for ( ; --i >= 0; ) {
2287
2047
  matchIndexes.push( i );
2288
2048
  }
2289
2049
  return matchIndexes;
2290
2050
  } ),
2291
2051
 
2292
- "gt": createPositionalPseudo( function( matchIndexes, length, argument ) {
2052
+ gt: createPositionalPseudo( function( matchIndexes, length, argument ) {
2293
2053
  var i = argument < 0 ? argument + length : argument;
2294
2054
  for ( ; ++i < length; ) {
2295
2055
  matchIndexes.push( i );
@@ -2299,7 +2059,7 @@ Expr = Sizzle.selectors = {
2299
2059
  }
2300
2060
  };
2301
2061
 
2302
- Expr.pseudos[ "nth" ] = Expr.pseudos[ "eq" ];
2062
+ Expr.pseudos.nth = Expr.pseudos.eq;
2303
2063
 
2304
2064
  // Add button/input type pseudos
2305
2065
  for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) {
@@ -2314,7 +2074,7 @@ function setFilters() {}
2314
2074
  setFilters.prototype = Expr.filters = Expr.pseudos;
2315
2075
  Expr.setFilters = new setFilters();
2316
2076
 
2317
- tokenize = Sizzle.tokenize = function( selector, parseOnly ) {
2077
+ function tokenize( selector, parseOnly ) {
2318
2078
  var matched, match, tokens, type,
2319
2079
  soFar, groups, preFilters,
2320
2080
  cached = tokenCache[ selector + " " ];
@@ -2342,13 +2102,13 @@ tokenize = Sizzle.tokenize = function( selector, parseOnly ) {
2342
2102
  matched = false;
2343
2103
 
2344
2104
  // Combinators
2345
- if ( ( match = rcombinators.exec( soFar ) ) ) {
2105
+ if ( ( match = rleadingCombinator.exec( soFar ) ) ) {
2346
2106
  matched = match.shift();
2347
2107
  tokens.push( {
2348
2108
  value: matched,
2349
2109
 
2350
2110
  // Cast descendant combinators to space
2351
- type: match[ 0 ].replace( rtrim, " " )
2111
+ type: match[ 0 ].replace( rtrimCSS, " " )
2352
2112
  } );
2353
2113
  soFar = soFar.slice( matched.length );
2354
2114
  }
@@ -2375,14 +2135,16 @@ tokenize = Sizzle.tokenize = function( selector, parseOnly ) {
2375
2135
  // Return the length of the invalid excess
2376
2136
  // if we're just parsing
2377
2137
  // Otherwise, throw an error or return tokens
2378
- return parseOnly ?
2379
- soFar.length :
2380
- soFar ?
2381
- Sizzle.error( selector ) :
2138
+ if ( parseOnly ) {
2139
+ return soFar.length;
2140
+ }
2382
2141
 
2383
- // Cache the tokens
2384
- tokenCache( selector, groups ).slice( 0 );
2385
- };
2142
+ return soFar ?
2143
+ find.error( selector ) :
2144
+
2145
+ // Cache the tokens
2146
+ tokenCache( selector, groups ).slice( 0 );
2147
+ }
2386
2148
 
2387
2149
  function toSelector( tokens ) {
2388
2150
  var i = 0,
@@ -2415,7 +2177,7 @@ function addCombinator( matcher, combinator, base ) {
2415
2177
 
2416
2178
  // Check against all ancestor/preceding elements
2417
2179
  function( elem, context, xml ) {
2418
- var oldCache, uniqueCache, outerCache,
2180
+ var oldCache, outerCache,
2419
2181
  newCache = [ dirruns, doneName ];
2420
2182
 
2421
2183
  // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching
@@ -2432,14 +2194,9 @@ function addCombinator( matcher, combinator, base ) {
2432
2194
  if ( elem.nodeType === 1 || checkNonElements ) {
2433
2195
  outerCache = elem[ expando ] || ( elem[ expando ] = {} );
2434
2196
 
2435
- // Support: IE <9 only
2436
- // Defend against cloned attroperties (jQuery gh-1709)
2437
- uniqueCache = outerCache[ elem.uniqueID ] ||
2438
- ( outerCache[ elem.uniqueID ] = {} );
2439
-
2440
- if ( skip && skip === elem.nodeName.toLowerCase() ) {
2197
+ if ( skip && nodeName( elem, skip ) ) {
2441
2198
  elem = elem[ dir ] || elem;
2442
- } else if ( ( oldCache = uniqueCache[ key ] ) &&
2199
+ } else if ( ( oldCache = outerCache[ key ] ) &&
2443
2200
  oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) {
2444
2201
 
2445
2202
  // Assign to newCache so results back-propagate to previous elements
@@ -2447,7 +2204,7 @@ function addCombinator( matcher, combinator, base ) {
2447
2204
  } else {
2448
2205
 
2449
2206
  // Reuse newcache so results back-propagate to previous elements
2450
- uniqueCache[ key ] = newCache;
2207
+ outerCache[ key ] = newCache;
2451
2208
 
2452
2209
  // A match means we're done; a fail means we have to keep checking
2453
2210
  if ( ( newCache[ 2 ] = matcher( elem, context, xml ) ) ) {
@@ -2479,7 +2236,7 @@ function multipleContexts( selector, contexts, results ) {
2479
2236
  var i = 0,
2480
2237
  len = contexts.length;
2481
2238
  for ( ; i < len; i++ ) {
2482
- Sizzle( selector, contexts[ i ], results );
2239
+ find( selector, contexts[ i ], results );
2483
2240
  }
2484
2241
  return results;
2485
2242
  }
@@ -2513,38 +2270,37 @@ function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postS
2513
2270
  postFinder = setMatcher( postFinder, postSelector );
2514
2271
  }
2515
2272
  return markFunction( function( seed, results, context, xml ) {
2516
- var temp, i, elem,
2273
+ var temp, i, elem, matcherOut,
2517
2274
  preMap = [],
2518
2275
  postMap = [],
2519
2276
  preexisting = results.length,
2520
2277
 
2521
2278
  // Get initial elements from seed or context
2522
- elems = seed || multipleContexts(
2523
- selector || "*",
2524
- context.nodeType ? [ context ] : context,
2525
- []
2526
- ),
2279
+ elems = seed ||
2280
+ multipleContexts( selector || "*",
2281
+ context.nodeType ? [ context ] : context, [] ),
2527
2282
 
2528
2283
  // Prefilter to get matcher input, preserving a map for seed-results synchronization
2529
2284
  matcherIn = preFilter && ( seed || !selector ) ?
2530
2285
  condense( elems, preMap, preFilter, context, xml ) :
2531
- elems,
2286
+ elems;
2532
2287
 
2533
- matcherOut = matcher ?
2288
+ if ( matcher ) {
2534
2289
 
2535
- // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
2536
- postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
2290
+ // If we have a postFinder, or filtered seed, or non-seed postFilter
2291
+ // or preexisting results,
2292
+ matcherOut = postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
2537
2293
 
2538
- // ...intermediate processing is necessary
2539
- [] :
2294
+ // ...intermediate processing is necessary
2295
+ [] :
2540
2296
 
2541
- // ...otherwise use results directly
2542
- results :
2543
- matcherIn;
2297
+ // ...otherwise use results directly
2298
+ results;
2544
2299
 
2545
- // Find primary matches
2546
- if ( matcher ) {
2300
+ // Find primary matches
2547
2301
  matcher( matcherIn, matcherOut, context, xml );
2302
+ } else {
2303
+ matcherOut = matcherIn;
2548
2304
  }
2549
2305
 
2550
2306
  // Apply postFilter
@@ -2582,7 +2338,7 @@ function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postS
2582
2338
  i = matcherOut.length;
2583
2339
  while ( i-- ) {
2584
2340
  if ( ( elem = matcherOut[ i ] ) &&
2585
- ( temp = postFinder ? indexOf( seed, elem ) : preMap[ i ] ) > -1 ) {
2341
+ ( temp = postFinder ? indexOf.call( seed, elem ) : preMap[ i ] ) > -1 ) {
2586
2342
 
2587
2343
  seed[ temp ] = !( results[ temp ] = elem );
2588
2344
  }
@@ -2617,15 +2373,21 @@ function matcherFromTokens( tokens ) {
2617
2373
  return elem === checkContext;
2618
2374
  }, implicitRelative, true ),
2619
2375
  matchAnyContext = addCombinator( function( elem ) {
2620
- return indexOf( checkContext, elem ) > -1;
2376
+ return indexOf.call( checkContext, elem ) > -1;
2621
2377
  }, implicitRelative, true ),
2622
2378
  matchers = [ function( elem, context, xml ) {
2623
- var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || (
2379
+
2380
+ // Support: IE 11+, Edge 17 - 18+
2381
+ // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
2382
+ // two documents; shallow comparisons work.
2383
+ // eslint-disable-next-line eqeqeq
2384
+ var ret = ( !leadingRelative && ( xml || context != outermostContext ) ) || (
2624
2385
  ( checkContext = context ).nodeType ?
2625
2386
  matchContext( elem, context, xml ) :
2626
2387
  matchAnyContext( elem, context, xml ) );
2627
2388
 
2628
- // Avoid hanging onto element (issue #299)
2389
+ // Avoid hanging onto element
2390
+ // (see https://github.com/jquery/sizzle/issues/299)
2629
2391
  checkContext = null;
2630
2392
  return ret;
2631
2393
  } ];
@@ -2650,11 +2412,10 @@ function matcherFromTokens( tokens ) {
2650
2412
  i > 1 && elementMatcher( matchers ),
2651
2413
  i > 1 && toSelector(
2652
2414
 
2653
- // If the preceding token was a descendant combinator, insert an implicit any-element `*`
2654
- tokens
2655
- .slice( 0, i - 1 )
2656
- .concat( { value: tokens[ i - 2 ].type === " " ? "*" : "" } )
2657
- ).replace( rtrim, "$1" ),
2415
+ // If the preceding token was a descendant combinator, insert an implicit any-element `*`
2416
+ tokens.slice( 0, i - 1 )
2417
+ .concat( { value: tokens[ i - 2 ].type === " " ? "*" : "" } )
2418
+ ).replace( rtrimCSS, "$1" ),
2658
2419
  matcher,
2659
2420
  i < j && matcherFromTokens( tokens.slice( i, j ) ),
2660
2421
  j < len && matcherFromTokens( ( tokens = tokens.slice( j ) ) ),
@@ -2680,7 +2441,7 @@ function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
2680
2441
  contextBackup = outermostContext,
2681
2442
 
2682
2443
  // We must always have either seed elements or outermost context
2683
- elems = seed || byElement && Expr.find[ "TAG" ]( "*", outermost ),
2444
+ elems = seed || byElement && Expr.find.TAG( "*", outermost ),
2684
2445
 
2685
2446
  // Use integer dirruns iff this is the outermost matcher
2686
2447
  dirrunsUnique = ( dirruns += contextBackup == null ? 1 : Math.random() || 0.1 ),
@@ -2696,8 +2457,9 @@ function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
2696
2457
  }
2697
2458
 
2698
2459
  // Add elements passing elementMatchers directly to results
2699
- // Support: IE<9, Safari
2700
- // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id
2460
+ // Support: iOS <=7 - 9 only
2461
+ // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching
2462
+ // elements by id. (see trac-14142)
2701
2463
  for ( ; i !== len && ( elem = elems[ i ] ) != null; i++ ) {
2702
2464
  if ( byElement && elem ) {
2703
2465
  j = 0;
@@ -2712,7 +2474,7 @@ function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
2712
2474
  }
2713
2475
  while ( ( matcher = elementMatchers[ j++ ] ) ) {
2714
2476
  if ( matcher( elem, context || document, xml ) ) {
2715
- results.push( elem );
2477
+ push.call( results, elem );
2716
2478
  break;
2717
2479
  }
2718
2480
  }
@@ -2775,7 +2537,7 @@ function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
2775
2537
  if ( outermost && !seed && setMatched.length > 0 &&
2776
2538
  ( matchedCount + setMatchers.length ) > 1 ) {
2777
2539
 
2778
- Sizzle.uniqueSort( results );
2540
+ jQuery.uniqueSort( results );
2779
2541
  }
2780
2542
  }
2781
2543
 
@@ -2793,7 +2555,7 @@ function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
2793
2555
  superMatcher;
2794
2556
  }
2795
2557
 
2796
- compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) {
2558
+ function compile( selector, match /* Internal Use Only */ ) {
2797
2559
  var i,
2798
2560
  setMatchers = [],
2799
2561
  elementMatchers = [],
@@ -2816,27 +2578,25 @@ compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) {
2816
2578
  }
2817
2579
 
2818
2580
  // Cache the compiled function
2819
- cached = compilerCache(
2820
- selector,
2821
- matcherFromGroupMatchers( elementMatchers, setMatchers )
2822
- );
2581
+ cached = compilerCache( selector,
2582
+ matcherFromGroupMatchers( elementMatchers, setMatchers ) );
2823
2583
 
2824
2584
  // Save selector and tokenization
2825
2585
  cached.selector = selector;
2826
2586
  }
2827
2587
  return cached;
2828
- };
2588
+ }
2829
2589
 
2830
2590
  /**
2831
- * A low-level selection function that works with Sizzle's compiled
2591
+ * A low-level selection function that works with jQuery's compiled
2832
2592
  * selector functions
2833
2593
  * @param {String|Function} selector A selector or a pre-compiled
2834
- * selector function built with Sizzle.compile
2594
+ * selector function built with jQuery selector compile
2835
2595
  * @param {Element} context
2836
2596
  * @param {Array} [results]
2837
2597
  * @param {Array} [seed] A set of elements to match against
2838
2598
  */
2839
- select = Sizzle.select = function( selector, context, results, seed ) {
2599
+ function select( selector, context, results, seed ) {
2840
2600
  var i, tokens, token, type, find,
2841
2601
  compiled = typeof selector === "function" && selector,
2842
2602
  match = !seed && tokenize( ( selector = compiled.selector || selector ) );
@@ -2850,10 +2610,12 @@ select = Sizzle.select = function( selector, context, results, seed ) {
2850
2610
  // Reduce context if the leading compound selector is an ID
2851
2611
  tokens = match[ 0 ] = match[ 0 ].slice( 0 );
2852
2612
  if ( tokens.length > 2 && ( token = tokens[ 0 ] ).type === "ID" &&
2853
- context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[ 1 ].type ] ) {
2613
+ context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[ 1 ].type ] ) {
2854
2614
 
2855
- context = ( Expr.find[ "ID" ]( token.matches[ 0 ]
2856
- .replace( runescape, funescape ), context ) || [] )[ 0 ];
2615
+ context = ( Expr.find.ID(
2616
+ token.matches[ 0 ].replace( runescape, funescape ),
2617
+ context
2618
+ ) || [] )[ 0 ];
2857
2619
  if ( !context ) {
2858
2620
  return results;
2859
2621
 
@@ -2866,7 +2628,7 @@ select = Sizzle.select = function( selector, context, results, seed ) {
2866
2628
  }
2867
2629
 
2868
2630
  // Fetch a seed set for right-to-left matching
2869
- i = matchExpr[ "needsContext" ].test( selector ) ? 0 : tokens.length;
2631
+ i = matchExpr.needsContext.test( selector ) ? 0 : tokens.length;
2870
2632
  while ( i-- ) {
2871
2633
  token = tokens[ i ];
2872
2634
 
@@ -2879,8 +2641,8 @@ select = Sizzle.select = function( selector, context, results, seed ) {
2879
2641
  // Search, expanding context for leading sibling combinators
2880
2642
  if ( ( seed = find(
2881
2643
  token.matches[ 0 ].replace( runescape, funescape ),
2882
- rsibling.test( tokens[ 0 ].type ) && testContext( context.parentNode ) ||
2883
- context
2644
+ rsibling.test( tokens[ 0 ].type ) &&
2645
+ testContext( context.parentNode ) || context
2884
2646
  ) ) ) {
2885
2647
 
2886
2648
  // If seed is empty or no tokens remain, we can return early
@@ -2907,21 +2669,18 @@ select = Sizzle.select = function( selector, context, results, seed ) {
2907
2669
  !context || rsibling.test( selector ) && testContext( context.parentNode ) || context
2908
2670
  );
2909
2671
  return results;
2910
- };
2672
+ }
2911
2673
 
2912
2674
  // One-time assignments
2913
2675
 
2676
+ // Support: Android <=4.0 - 4.1+
2914
2677
  // Sort stability
2915
2678
  support.sortStable = expando.split( "" ).sort( sortOrder ).join( "" ) === expando;
2916
2679
 
2917
- // Support: Chrome 14-35+
2918
- // Always assume duplicates if they aren't passed to the comparison function
2919
- support.detectDuplicates = !!hasDuplicate;
2920
-
2921
2680
  // Initialize against the default document
2922
2681
  setDocument();
2923
2682
 
2924
- // Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27)
2683
+ // Support: Android <=4.0 - 4.1+
2925
2684
  // Detached nodes confoundingly follow *each other*
2926
2685
  support.sortDetached = assert( function( el ) {
2927
2686
 
@@ -2929,68 +2688,29 @@ support.sortDetached = assert( function( el ) {
2929
2688
  return el.compareDocumentPosition( document.createElement( "fieldset" ) ) & 1;
2930
2689
  } );
2931
2690
 
2932
- // Support: IE<8
2933
- // Prevent attribute/property "interpolation"
2934
- // https://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
2935
- if ( !assert( function( el ) {
2936
- el.innerHTML = "<a href='#'></a>";
2937
- return el.firstChild.getAttribute( "href" ) === "#";
2938
- } ) ) {
2939
- addHandle( "type|href|height|width", function( elem, name, isXML ) {
2940
- if ( !isXML ) {
2941
- return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 );
2942
- }
2943
- } );
2944
- }
2945
-
2946
- // Support: IE<9
2947
- // Use defaultValue in place of getAttribute("value")
2948
- if ( !support.attributes || !assert( function( el ) {
2949
- el.innerHTML = "<input/>";
2950
- el.firstChild.setAttribute( "value", "" );
2951
- return el.firstChild.getAttribute( "value" ) === "";
2952
- } ) ) {
2953
- addHandle( "value", function( elem, _name, isXML ) {
2954
- if ( !isXML && elem.nodeName.toLowerCase() === "input" ) {
2955
- return elem.defaultValue;
2956
- }
2957
- } );
2958
- }
2959
-
2960
- // Support: IE<9
2961
- // Use getAttributeNode to fetch booleans when getAttribute lies
2962
- if ( !assert( function( el ) {
2963
- return el.getAttribute( "disabled" ) == null;
2964
- } ) ) {
2965
- addHandle( booleans, function( elem, name, isXML ) {
2966
- var val;
2967
- if ( !isXML ) {
2968
- return elem[ name ] === true ? name.toLowerCase() :
2969
- ( val = elem.getAttributeNode( name ) ) && val.specified ?
2970
- val.value :
2971
- null;
2972
- }
2973
- } );
2974
- }
2975
-
2976
- return Sizzle;
2977
-
2978
- } )( window );
2979
-
2980
-
2981
-
2982
- jQuery.find = Sizzle;
2983
- jQuery.expr = Sizzle.selectors;
2691
+ jQuery.find = find;
2984
2692
 
2985
2693
  // Deprecated
2986
2694
  jQuery.expr[ ":" ] = jQuery.expr.pseudos;
2987
- jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort;
2988
- jQuery.text = Sizzle.getText;
2989
- jQuery.isXMLDoc = Sizzle.isXML;
2990
- jQuery.contains = Sizzle.contains;
2991
- jQuery.escapeSelector = Sizzle.escape;
2695
+ jQuery.unique = jQuery.uniqueSort;
2696
+
2697
+ // These have always been private, but they used to be documented
2698
+ // as part of Sizzle so let's maintain them in the 3.x line
2699
+ // for backwards compatibility purposes.
2700
+ find.compile = compile;
2701
+ find.select = select;
2702
+ find.setDocument = setDocument;
2992
2703
 
2704
+ find.escape = jQuery.escapeSelector;
2705
+ find.getText = jQuery.text;
2706
+ find.isXML = jQuery.isXMLDoc;
2707
+ find.selectors = jQuery.expr;
2708
+ find.support = jQuery.support;
2709
+ find.uniqueSort = jQuery.uniqueSort;
2993
2710
 
2711
+ /* eslint-enable */
2712
+
2713
+ } )();
2994
2714
 
2995
2715
 
2996
2716
  var dir = function( elem, dir, until ) {
@@ -3024,13 +2744,6 @@ var siblings = function( n, elem ) {
3024
2744
 
3025
2745
  var rneedsContext = jQuery.expr.match.needsContext;
3026
2746
 
3027
-
3028
-
3029
- function nodeName( elem, name ) {
3030
-
3031
- return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
3032
-
3033
- }
3034
2747
  var rsingleTag = ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i );
3035
2748
 
3036
2749
 
@@ -3281,7 +2994,7 @@ jQuery.fn.extend( {
3281
2994
  if ( cur.nodeType < 11 && ( targets ?
3282
2995
  targets.index( cur ) > -1 :
3283
2996
 
3284
- // Don't pass non-elements to Sizzle
2997
+ // Don't pass non-elements to jQuery#find
3285
2998
  cur.nodeType === 1 &&
3286
2999
  jQuery.find.matchesSelector( cur, selectors ) ) ) {
3287
3000
 
@@ -3836,7 +3549,7 @@ jQuery.extend( {
3836
3549
 
3837
3550
  if ( jQuery.Deferred.exceptionHook ) {
3838
3551
  jQuery.Deferred.exceptionHook( e,
3839
- process.stackTrace );
3552
+ process.error );
3840
3553
  }
3841
3554
 
3842
3555
  // Support: Promises/A+ section 2.3.3.3.4.1
@@ -3864,10 +3577,17 @@ jQuery.extend( {
3864
3577
  process();
3865
3578
  } else {
3866
3579
 
3867
- // Call an optional hook to record the stack, in case of exception
3580
+ // Call an optional hook to record the error, in case of exception
3868
3581
  // since it's otherwise lost when execution goes async
3869
- if ( jQuery.Deferred.getStackHook ) {
3870
- process.stackTrace = jQuery.Deferred.getStackHook();
3582
+ if ( jQuery.Deferred.getErrorHook ) {
3583
+ process.error = jQuery.Deferred.getErrorHook();
3584
+
3585
+ // The deprecated alias of the above. While the name suggests
3586
+ // returning the stack, not an error instance, jQuery just passes
3587
+ // it directly to `console.warn` so both will work; an instance
3588
+ // just better cooperates with source maps.
3589
+ } else if ( jQuery.Deferred.getStackHook ) {
3590
+ process.error = jQuery.Deferred.getStackHook();
3871
3591
  }
3872
3592
  window.setTimeout( process );
3873
3593
  }
@@ -4042,12 +3762,16 @@ jQuery.extend( {
4042
3762
  // warn about them ASAP rather than swallowing them by default.
4043
3763
  var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;
4044
3764
 
4045
- jQuery.Deferred.exceptionHook = function( error, stack ) {
3765
+ // If `jQuery.Deferred.getErrorHook` is defined, `asyncError` is an error
3766
+ // captured before the async barrier to get the original error cause
3767
+ // which may otherwise be hidden.
3768
+ jQuery.Deferred.exceptionHook = function( error, asyncError ) {
4046
3769
 
4047
3770
  // Support: IE 8 - 9 only
4048
3771
  // Console exists when dev tools are open, which can happen at any time
4049
3772
  if ( window.console && window.console.warn && error && rerrorNames.test( error.name ) ) {
4050
- window.console.warn( "jQuery.Deferred exception: " + error.message, error.stack, stack );
3773
+ window.console.warn( "jQuery.Deferred exception: " + error.message,
3774
+ error.stack, asyncError );
4051
3775
  }
4052
3776
  };
4053
3777
 
@@ -5103,25 +4827,6 @@ function returnFalse() {
5103
4827
  return false;
5104
4828
  }
5105
4829
 
5106
- // Support: IE <=9 - 11+
5107
- // focus() and blur() are asynchronous, except when they are no-op.
5108
- // So expect focus to be synchronous when the element is already active,
5109
- // and blur to be synchronous when the element is not already active.
5110
- // (focus and blur are always synchronous in other supported browsers,
5111
- // this just defines when we can count on it).
5112
- function expectSync( elem, type ) {
5113
- return ( elem === safeActiveElement() ) === ( type === "focus" );
5114
- }
5115
-
5116
- // Support: IE <=9 only
5117
- // Accessing document.activeElement can throw unexpectedly
5118
- // https://bugs.jquery.com/ticket/13393
5119
- function safeActiveElement() {
5120
- try {
5121
- return document.activeElement;
5122
- } catch ( err ) { }
5123
- }
5124
-
5125
4830
  function on( elem, types, selector, data, fn, one ) {
5126
4831
  var origFn, type;
5127
4832
 
@@ -5559,7 +5264,7 @@ jQuery.event = {
5559
5264
  el.click && nodeName( el, "input" ) ) {
5560
5265
 
5561
5266
  // dataPriv.set( el, "click", ... )
5562
- leverageNative( el, "click", returnTrue );
5267
+ leverageNative( el, "click", true );
5563
5268
  }
5564
5269
 
5565
5270
  // Return false to allow normal processing in the caller
@@ -5610,10 +5315,10 @@ jQuery.event = {
5610
5315
  // synthetic events by interrupting progress until reinvoked in response to
5611
5316
  // *native* events that it fires directly, ensuring that state changes have
5612
5317
  // already occurred before other listeners are invoked.
5613
- function leverageNative( el, type, expectSync ) {
5318
+ function leverageNative( el, type, isSetup ) {
5614
5319
 
5615
- // Missing expectSync indicates a trigger call, which must force setup through jQuery.event.add
5616
- if ( !expectSync ) {
5320
+ // Missing `isSetup` indicates a trigger call, which must force setup through jQuery.event.add
5321
+ if ( !isSetup ) {
5617
5322
  if ( dataPriv.get( el, type ) === undefined ) {
5618
5323
  jQuery.event.add( el, type, returnTrue );
5619
5324
  }
@@ -5625,15 +5330,13 @@ function leverageNative( el, type, expectSync ) {
5625
5330
  jQuery.event.add( el, type, {
5626
5331
  namespace: false,
5627
5332
  handler: function( event ) {
5628
- var notAsync, result,
5333
+ var result,
5629
5334
  saved = dataPriv.get( this, type );
5630
5335
 
5631
5336
  if ( ( event.isTrigger & 1 ) && this[ type ] ) {
5632
5337
 
5633
5338
  // Interrupt processing of the outer synthetic .trigger()ed event
5634
- // Saved data should be false in such cases, but might be a leftover capture object
5635
- // from an async native handler (gh-4350)
5636
- if ( !saved.length ) {
5339
+ if ( !saved ) {
5637
5340
 
5638
5341
  // Store arguments for use when handling the inner native event
5639
5342
  // There will always be at least one argument (an event object), so this array
@@ -5642,33 +5345,22 @@ function leverageNative( el, type, expectSync ) {
5642
5345
  dataPriv.set( this, type, saved );
5643
5346
 
5644
5347
  // Trigger the native event and capture its result
5645
- // Support: IE <=9 - 11+
5646
- // focus() and blur() are asynchronous
5647
- notAsync = expectSync( this, type );
5648
5348
  this[ type ]();
5649
5349
  result = dataPriv.get( this, type );
5650
- if ( saved !== result || notAsync ) {
5651
- dataPriv.set( this, type, false );
5652
- } else {
5653
- result = {};
5654
- }
5350
+ dataPriv.set( this, type, false );
5351
+
5655
5352
  if ( saved !== result ) {
5656
5353
 
5657
5354
  // Cancel the outer synthetic event
5658
5355
  event.stopImmediatePropagation();
5659
5356
  event.preventDefault();
5660
5357
 
5661
- // Support: Chrome 86+
5662
- // In Chrome, if an element having a focusout handler is blurred by
5663
- // clicking outside of it, it invokes the handler synchronously. If
5664
- // that handler calls `.remove()` on the element, the data is cleared,
5665
- // leaving `result` undefined. We need to guard against this.
5666
- return result && result.value;
5358
+ return result;
5667
5359
  }
5668
5360
 
5669
5361
  // If this is an inner synthetic event for an event with a bubbling surrogate
5670
- // (focus or blur), assume that the surrogate already propagated from triggering the
5671
- // native event and prevent that from happening again here.
5362
+ // (focus or blur), assume that the surrogate already propagated from triggering
5363
+ // the native event and prevent that from happening again here.
5672
5364
  // This technically gets the ordering wrong w.r.t. to `.trigger()` (in which the
5673
5365
  // bubbling surrogate propagates *after* the non-bubbling base), but that seems
5674
5366
  // less bad than duplication.
@@ -5678,22 +5370,25 @@ function leverageNative( el, type, expectSync ) {
5678
5370
 
5679
5371
  // If this is a native event triggered above, everything is now in order
5680
5372
  // Fire an inner synthetic event with the original arguments
5681
- } else if ( saved.length ) {
5373
+ } else if ( saved ) {
5682
5374
 
5683
5375
  // ...and capture the result
5684
- dataPriv.set( this, type, {
5685
- value: jQuery.event.trigger(
5686
-
5687
- // Support: IE <=9 - 11+
5688
- // Extend with the prototype to reset the above stopImmediatePropagation()
5689
- jQuery.extend( saved[ 0 ], jQuery.Event.prototype ),
5690
- saved.slice( 1 ),
5691
- this
5692
- )
5693
- } );
5694
-
5695
- // Abort handling of the native event
5696
- event.stopImmediatePropagation();
5376
+ dataPriv.set( this, type, jQuery.event.trigger(
5377
+ saved[ 0 ],
5378
+ saved.slice( 1 ),
5379
+ this
5380
+ ) );
5381
+
5382
+ // Abort handling of the native event by all jQuery handlers while allowing
5383
+ // native handlers on the same element to run. On target, this is achieved
5384
+ // by stopping immediate propagation just on the jQuery event. However,
5385
+ // the native event is re-wrapped by a jQuery one on each level of the
5386
+ // propagation so the only way to stop it for jQuery is to stop it for
5387
+ // everyone via native `stopPropagation()`. This is not a problem for
5388
+ // focus/blur which don't bubble, but it does also stop click on checkboxes
5389
+ // and radios. We accept this limitation.
5390
+ event.stopPropagation();
5391
+ event.isImmediatePropagationStopped = returnTrue;
5697
5392
  }
5698
5393
  }
5699
5394
  } );
@@ -5832,18 +5527,73 @@ jQuery.each( {
5832
5527
  }, jQuery.event.addProp );
5833
5528
 
5834
5529
  jQuery.each( { focus: "focusin", blur: "focusout" }, function( type, delegateType ) {
5530
+
5531
+ function focusMappedHandler( nativeEvent ) {
5532
+ if ( document.documentMode ) {
5533
+
5534
+ // Support: IE 11+
5535
+ // Attach a single focusin/focusout handler on the document while someone wants
5536
+ // focus/blur. This is because the former are synchronous in IE while the latter
5537
+ // are async. In other browsers, all those handlers are invoked synchronously.
5538
+
5539
+ // `handle` from private data would already wrap the event, but we need
5540
+ // to change the `type` here.
5541
+ var handle = dataPriv.get( this, "handle" ),
5542
+ event = jQuery.event.fix( nativeEvent );
5543
+ event.type = nativeEvent.type === "focusin" ? "focus" : "blur";
5544
+ event.isSimulated = true;
5545
+
5546
+ // First, handle focusin/focusout
5547
+ handle( nativeEvent );
5548
+
5549
+ // ...then, handle focus/blur
5550
+ //
5551
+ // focus/blur don't bubble while focusin/focusout do; simulate the former by only
5552
+ // invoking the handler at the lower level.
5553
+ if ( event.target === event.currentTarget ) {
5554
+
5555
+ // The setup part calls `leverageNative`, which, in turn, calls
5556
+ // `jQuery.event.add`, so event handle will already have been set
5557
+ // by this point.
5558
+ handle( event );
5559
+ }
5560
+ } else {
5561
+
5562
+ // For non-IE browsers, attach a single capturing handler on the document
5563
+ // while someone wants focusin/focusout.
5564
+ jQuery.event.simulate( delegateType, nativeEvent.target,
5565
+ jQuery.event.fix( nativeEvent ) );
5566
+ }
5567
+ }
5568
+
5835
5569
  jQuery.event.special[ type ] = {
5836
5570
 
5837
5571
  // Utilize native event if possible so blur/focus sequence is correct
5838
5572
  setup: function() {
5839
5573
 
5574
+ var attaches;
5575
+
5840
5576
  // Claim the first handler
5841
5577
  // dataPriv.set( this, "focus", ... )
5842
5578
  // dataPriv.set( this, "blur", ... )
5843
- leverageNative( this, type, expectSync );
5579
+ leverageNative( this, type, true );
5844
5580
 
5845
- // Return false to allow normal processing in the caller
5846
- return false;
5581
+ if ( document.documentMode ) {
5582
+
5583
+ // Support: IE 9 - 11+
5584
+ // We use the same native handler for focusin & focus (and focusout & blur)
5585
+ // so we need to coordinate setup & teardown parts between those events.
5586
+ // Use `delegateType` as the key as `type` is already used by `leverageNative`.
5587
+ attaches = dataPriv.get( this, delegateType );
5588
+ if ( !attaches ) {
5589
+ this.addEventListener( delegateType, focusMappedHandler );
5590
+ }
5591
+ dataPriv.set( this, delegateType, ( attaches || 0 ) + 1 );
5592
+ } else {
5593
+
5594
+ // Return false to allow normal processing in the caller
5595
+ return false;
5596
+ }
5847
5597
  },
5848
5598
  trigger: function() {
5849
5599
 
@@ -5854,6 +5604,24 @@ jQuery.each( { focus: "focusin", blur: "focusout" }, function( type, delegateTyp
5854
5604
  return true;
5855
5605
  },
5856
5606
 
5607
+ teardown: function() {
5608
+ var attaches;
5609
+
5610
+ if ( document.documentMode ) {
5611
+ attaches = dataPriv.get( this, delegateType ) - 1;
5612
+ if ( !attaches ) {
5613
+ this.removeEventListener( delegateType, focusMappedHandler );
5614
+ dataPriv.remove( this, delegateType );
5615
+ } else {
5616
+ dataPriv.set( this, delegateType, attaches );
5617
+ }
5618
+ } else {
5619
+
5620
+ // Return false to indicate standard teardown should be applied
5621
+ return false;
5622
+ }
5623
+ },
5624
+
5857
5625
  // Suppress native focus or blur if we're currently inside
5858
5626
  // a leveraged native-event stack
5859
5627
  _default: function( event ) {
@@ -5862,6 +5630,58 @@ jQuery.each( { focus: "focusin", blur: "focusout" }, function( type, delegateTyp
5862
5630
 
5863
5631
  delegateType: delegateType
5864
5632
  };
5633
+
5634
+ // Support: Firefox <=44
5635
+ // Firefox doesn't have focus(in | out) events
5636
+ // Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787
5637
+ //
5638
+ // Support: Chrome <=48 - 49, Safari <=9.0 - 9.1
5639
+ // focus(in | out) events fire after focus & blur events,
5640
+ // which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order
5641
+ // Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857
5642
+ //
5643
+ // Support: IE 9 - 11+
5644
+ // To preserve relative focusin/focus & focusout/blur event order guaranteed on the 3.x branch,
5645
+ // attach a single handler for both events in IE.
5646
+ jQuery.event.special[ delegateType ] = {
5647
+ setup: function() {
5648
+
5649
+ // Handle: regular nodes (via `this.ownerDocument`), window
5650
+ // (via `this.document`) & document (via `this`).
5651
+ var doc = this.ownerDocument || this.document || this,
5652
+ dataHolder = document.documentMode ? this : doc,
5653
+ attaches = dataPriv.get( dataHolder, delegateType );
5654
+
5655
+ // Support: IE 9 - 11+
5656
+ // We use the same native handler for focusin & focus (and focusout & blur)
5657
+ // so we need to coordinate setup & teardown parts between those events.
5658
+ // Use `delegateType` as the key as `type` is already used by `leverageNative`.
5659
+ if ( !attaches ) {
5660
+ if ( document.documentMode ) {
5661
+ this.addEventListener( delegateType, focusMappedHandler );
5662
+ } else {
5663
+ doc.addEventListener( type, focusMappedHandler, true );
5664
+ }
5665
+ }
5666
+ dataPriv.set( dataHolder, delegateType, ( attaches || 0 ) + 1 );
5667
+ },
5668
+ teardown: function() {
5669
+ var doc = this.ownerDocument || this.document || this,
5670
+ dataHolder = document.documentMode ? this : doc,
5671
+ attaches = dataPriv.get( dataHolder, delegateType ) - 1;
5672
+
5673
+ if ( !attaches ) {
5674
+ if ( document.documentMode ) {
5675
+ this.removeEventListener( delegateType, focusMappedHandler );
5676
+ } else {
5677
+ doc.removeEventListener( type, focusMappedHandler, true );
5678
+ }
5679
+ dataPriv.remove( dataHolder, delegateType );
5680
+ } else {
5681
+ dataPriv.set( dataHolder, delegateType, attaches );
5682
+ }
5683
+ }
5684
+ };
5865
5685
  } );
5866
5686
 
5867
5687
  // Create mouseenter/leave events using mouseover/out and event-time checks
@@ -6164,7 +5984,8 @@ jQuery.extend( {
6164
5984
  if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) &&
6165
5985
  !jQuery.isXMLDoc( elem ) ) {
6166
5986
 
6167
- // We eschew Sizzle here for performance reasons: https://jsperf.com/getall-vs-sizzle/2
5987
+ // We eschew jQuery#find here for performance reasons:
5988
+ // https://jsperf.com/getall-vs-sizzle/2
6168
5989
  destElements = getAll( clone );
6169
5990
  srcElements = getAll( elem );
6170
5991
 
@@ -6440,15 +6261,6 @@ var swap = function( elem, options, callback ) {
6440
6261
 
6441
6262
  var rboxStyle = new RegExp( cssExpand.join( "|" ), "i" );
6442
6263
 
6443
- var whitespace = "[\\x20\\t\\r\\n\\f]";
6444
-
6445
-
6446
- var rtrimCSS = new RegExp(
6447
- "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$",
6448
- "g"
6449
- );
6450
-
6451
-
6452
6264
 
6453
6265
 
6454
6266
  ( function() {
@@ -6608,17 +6420,37 @@ function curCSS( elem, name, computed ) {
6608
6420
  // .css('filter') (IE 9 only, trac-12537)
6609
6421
  // .css('--customProperty) (gh-3144)
6610
6422
  if ( computed ) {
6611
- ret = computed.getPropertyValue( name ) || computed[ name ];
6612
6423
 
6613
- // trim whitespace for custom property (issue gh-4926)
6614
- if ( isCustomProp ) {
6424
+ // Support: IE <=9 - 11+
6425
+ // IE only supports `"float"` in `getPropertyValue`; in computed styles
6426
+ // it's only available as `"cssFloat"`. We no longer modify properties
6427
+ // sent to `.css()` apart from camelCasing, so we need to check both.
6428
+ // Normally, this would create difference in behavior: if
6429
+ // `getPropertyValue` returns an empty string, the value returned
6430
+ // by `.css()` would be `undefined`. This is usually the case for
6431
+ // disconnected elements. However, in IE even disconnected elements
6432
+ // with no styles return `"none"` for `getPropertyValue( "float" )`
6433
+ ret = computed.getPropertyValue( name ) || computed[ name ];
6615
6434
 
6616
- // rtrim treats U+000D CARRIAGE RETURN and U+000C FORM FEED
6435
+ if ( isCustomProp && ret ) {
6436
+
6437
+ // Support: Firefox 105+, Chrome <=105+
6438
+ // Spec requires trimming whitespace for custom properties (gh-4926).
6439
+ // Firefox only trims leading whitespace. Chrome just collapses
6440
+ // both leading & trailing whitespace to a single space.
6441
+ //
6442
+ // Fall back to `undefined` if empty string returned.
6443
+ // This collapses a missing definition with property defined
6444
+ // and set to an empty string but there's no standard API
6445
+ // allowing us to differentiate them without a performance penalty
6446
+ // and returning `undefined` aligns with older jQuery.
6447
+ //
6448
+ // rtrimCSS treats U+000D CARRIAGE RETURN and U+000C FORM FEED
6617
6449
  // as whitespace while CSS does not, but this is not a problem
6618
6450
  // because CSS preprocessing replaces them with U+000A LINE FEED
6619
6451
  // (which *is* CSS whitespace)
6620
6452
  // https://www.w3.org/TR/css-syntax-3/#input-preprocessing
6621
- ret = ret.replace( rtrimCSS, "$1" );
6453
+ ret = ret.replace( rtrimCSS, "$1" ) || undefined;
6622
6454
  }
6623
6455
 
6624
6456
  if ( ret === "" && !isAttached( elem ) ) {
@@ -6737,7 +6569,8 @@ function setPositiveNumber( _elem, value, subtract ) {
6737
6569
  function boxModelAdjustment( elem, dimension, box, isBorderBox, styles, computedVal ) {
6738
6570
  var i = dimension === "width" ? 1 : 0,
6739
6571
  extra = 0,
6740
- delta = 0;
6572
+ delta = 0,
6573
+ marginDelta = 0;
6741
6574
 
6742
6575
  // Adjustment may not be necessary
6743
6576
  if ( box === ( isBorderBox ? "border" : "content" ) ) {
@@ -6747,8 +6580,10 @@ function boxModelAdjustment( elem, dimension, box, isBorderBox, styles, computed
6747
6580
  for ( ; i < 4; i += 2 ) {
6748
6581
 
6749
6582
  // Both box models exclude margin
6583
+ // Count margin delta separately to only add it after scroll gutter adjustment.
6584
+ // This is needed to make negative margins work with `outerHeight( true )` (gh-3982).
6750
6585
  if ( box === "margin" ) {
6751
- delta += jQuery.css( elem, box + cssExpand[ i ], true, styles );
6586
+ marginDelta += jQuery.css( elem, box + cssExpand[ i ], true, styles );
6752
6587
  }
6753
6588
 
6754
6589
  // If we get here with a content-box, we're seeking "padding" or "border" or "margin"
@@ -6799,7 +6634,7 @@ function boxModelAdjustment( elem, dimension, box, isBorderBox, styles, computed
6799
6634
  ) ) || 0;
6800
6635
  }
6801
6636
 
6802
- return delta;
6637
+ return delta + marginDelta;
6803
6638
  }
6804
6639
 
6805
6640
  function getWidthOrHeight( elem, dimension, extra ) {
@@ -6897,26 +6732,35 @@ jQuery.extend( {
6897
6732
 
6898
6733
  // Don't automatically add "px" to these possibly-unitless properties
6899
6734
  cssNumber: {
6900
- "animationIterationCount": true,
6901
- "columnCount": true,
6902
- "fillOpacity": true,
6903
- "flexGrow": true,
6904
- "flexShrink": true,
6905
- "fontWeight": true,
6906
- "gridArea": true,
6907
- "gridColumn": true,
6908
- "gridColumnEnd": true,
6909
- "gridColumnStart": true,
6910
- "gridRow": true,
6911
- "gridRowEnd": true,
6912
- "gridRowStart": true,
6913
- "lineHeight": true,
6914
- "opacity": true,
6915
- "order": true,
6916
- "orphans": true,
6917
- "widows": true,
6918
- "zIndex": true,
6919
- "zoom": true
6735
+ animationIterationCount: true,
6736
+ aspectRatio: true,
6737
+ borderImageSlice: true,
6738
+ columnCount: true,
6739
+ flexGrow: true,
6740
+ flexShrink: true,
6741
+ fontWeight: true,
6742
+ gridArea: true,
6743
+ gridColumn: true,
6744
+ gridColumnEnd: true,
6745
+ gridColumnStart: true,
6746
+ gridRow: true,
6747
+ gridRowEnd: true,
6748
+ gridRowStart: true,
6749
+ lineHeight: true,
6750
+ opacity: true,
6751
+ order: true,
6752
+ orphans: true,
6753
+ scale: true,
6754
+ widows: true,
6755
+ zIndex: true,
6756
+ zoom: true,
6757
+
6758
+ // SVG-related
6759
+ fillOpacity: true,
6760
+ floodOpacity: true,
6761
+ stopOpacity: true,
6762
+ strokeMiterlimit: true,
6763
+ strokeOpacity: true
6920
6764
  },
6921
6765
 
6922
6766
  // Add in properties whose names you wish to fix before
@@ -8642,9 +8486,39 @@ jQuery.each( [ "radio", "checkbox" ], function() {
8642
8486
 
8643
8487
 
8644
8488
  // Return jQuery for attributes-only inclusion
8489
+ var location = window.location;
8490
+
8491
+ var nonce = { guid: Date.now() };
8492
+
8493
+ var rquery = ( /\?/ );
8494
+
8495
+
8645
8496
 
8497
+ // Cross-browser xml parsing
8498
+ jQuery.parseXML = function( data ) {
8499
+ var xml, parserErrorElem;
8500
+ if ( !data || typeof data !== "string" ) {
8501
+ return null;
8502
+ }
8646
8503
 
8647
- support.focusin = "onfocusin" in window;
8504
+ // Support: IE 9 - 11 only
8505
+ // IE throws on parseFromString with invalid input.
8506
+ try {
8507
+ xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" );
8508
+ } catch ( e ) {}
8509
+
8510
+ parserErrorElem = xml && xml.getElementsByTagName( "parsererror" )[ 0 ];
8511
+ if ( !xml || parserErrorElem ) {
8512
+ jQuery.error( "Invalid XML: " + (
8513
+ parserErrorElem ?
8514
+ jQuery.map( parserErrorElem.childNodes, function( el ) {
8515
+ return el.textContent;
8516
+ } ).join( "\n" ) :
8517
+ data
8518
+ ) );
8519
+ }
8520
+ return xml;
8521
+ };
8648
8522
 
8649
8523
 
8650
8524
  var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
@@ -8832,85 +8706,6 @@ jQuery.fn.extend( {
8832
8706
  } );
8833
8707
 
8834
8708
 
8835
- // Support: Firefox <=44
8836
- // Firefox doesn't have focus(in | out) events
8837
- // Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787
8838
- //
8839
- // Support: Chrome <=48 - 49, Safari <=9.0 - 9.1
8840
- // focus(in | out) events fire after focus & blur events,
8841
- // which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order
8842
- // Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857
8843
- if ( !support.focusin ) {
8844
- jQuery.each( { focus: "focusin", blur: "focusout" }, function( orig, fix ) {
8845
-
8846
- // Attach a single capturing handler on the document while someone wants focusin/focusout
8847
- var handler = function( event ) {
8848
- jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ) );
8849
- };
8850
-
8851
- jQuery.event.special[ fix ] = {
8852
- setup: function() {
8853
-
8854
- // Handle: regular nodes (via `this.ownerDocument`), window
8855
- // (via `this.document`) & document (via `this`).
8856
- var doc = this.ownerDocument || this.document || this,
8857
- attaches = dataPriv.access( doc, fix );
8858
-
8859
- if ( !attaches ) {
8860
- doc.addEventListener( orig, handler, true );
8861
- }
8862
- dataPriv.access( doc, fix, ( attaches || 0 ) + 1 );
8863
- },
8864
- teardown: function() {
8865
- var doc = this.ownerDocument || this.document || this,
8866
- attaches = dataPriv.access( doc, fix ) - 1;
8867
-
8868
- if ( !attaches ) {
8869
- doc.removeEventListener( orig, handler, true );
8870
- dataPriv.remove( doc, fix );
8871
-
8872
- } else {
8873
- dataPriv.access( doc, fix, attaches );
8874
- }
8875
- }
8876
- };
8877
- } );
8878
- }
8879
- var location = window.location;
8880
-
8881
- var nonce = { guid: Date.now() };
8882
-
8883
- var rquery = ( /\?/ );
8884
-
8885
-
8886
-
8887
- // Cross-browser xml parsing
8888
- jQuery.parseXML = function( data ) {
8889
- var xml, parserErrorElem;
8890
- if ( !data || typeof data !== "string" ) {
8891
- return null;
8892
- }
8893
-
8894
- // Support: IE 9 - 11 only
8895
- // IE throws on parseFromString with invalid input.
8896
- try {
8897
- xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" );
8898
- } catch ( e ) {}
8899
-
8900
- parserErrorElem = xml && xml.getElementsByTagName( "parsererror" )[ 0 ];
8901
- if ( !xml || parserErrorElem ) {
8902
- jQuery.error( "Invalid XML: " + (
8903
- parserErrorElem ?
8904
- jQuery.map( parserErrorElem.childNodes, function( el ) {
8905
- return el.textContent;
8906
- } ).join( "\n" ) :
8907
- data
8908
- ) );
8909
- }
8910
- return xml;
8911
- };
8912
-
8913
-
8914
8709
  var
8915
8710
  rbracket = /\[\]$/,
8916
8711
  rCRLF = /\r?\n/g,