jquery-rails 4.5.0 → 4.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,15 +1,12 @@
1
1
  /*!
2
- * jQuery JavaScript Library v3.6.0
2
+ * jQuery JavaScript Library v3.7.1
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: 2021-03-02T17:08Z
9
+ * Date: 2023-08-28T13:37Z
13
10
  */
14
11
  ( function( global, factory ) {
15
12
 
@@ -23,7 +20,7 @@
23
20
  // (such as Node.js), expose a factory as module.exports.
24
21
  // This accentuates the need for the creation of a real `window`.
25
22
  // e.g. var jQuery = require("jquery")(window);
26
- // See ticket #14549 for more info.
23
+ // See ticket trac-14549 for more info.
27
24
  module.exports = global.document ?
28
25
  factory( global, true ) :
29
26
  function( w ) {
@@ -150,8 +147,9 @@ function toType( obj ) {
150
147
 
151
148
 
152
149
 
153
- var
154
- version = "3.6.0",
150
+ var version = "3.7.1",
151
+
152
+ rhtmlSuffix = /HTML$/i,
155
153
 
156
154
  // Define a local copy of jQuery
157
155
  jQuery = function( selector, context ) {
@@ -397,6 +395,38 @@ 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
+ }
415
+ if ( nodeType === 1 || nodeType === 11 ) {
416
+ return elem.textContent;
417
+ }
418
+ if ( nodeType === 9 ) {
419
+ return elem.documentElement.textContent;
420
+ }
421
+ if ( nodeType === 3 || nodeType === 4 ) {
422
+ return elem.nodeValue;
423
+ }
424
+
425
+ // Do not include comment or processing instruction nodes
426
+
427
+ return ret;
428
+ },
429
+
400
430
  // results is for internal usage only
401
431
  makeArray: function( arr, results ) {
402
432
  var ret = results || [];
@@ -419,6 +449,15 @@ jQuery.extend( {
419
449
  return arr == null ? -1 : indexOf.call( arr, elem, i );
420
450
  },
421
451
 
452
+ isXMLDoc: function( elem ) {
453
+ var namespace = elem && elem.namespaceURI,
454
+ docElem = elem && ( elem.ownerDocument || elem ).documentElement;
455
+
456
+ // Assume HTML when documentElement doesn't yet exist, such as inside
457
+ // document fragments.
458
+ return !rhtmlSuffix.test( namespace || docElem && docElem.nodeName || "HTML" );
459
+ },
460
+
422
461
  // Support: Android <=4.0 only, PhantomJS 1 only
423
462
  // push.apply(_, arraylike) throws on ancient WebKit
424
463
  merge: function( first, second ) {
@@ -520,43 +559,98 @@ function isArrayLike( obj ) {
520
559
  return type === "array" || length === 0 ||
521
560
  typeof length === "number" && length > 0 && ( length - 1 ) in obj;
522
561
  }
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 ) {
562
+
563
+
564
+ function nodeName( elem, name ) {
565
+
566
+ return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
567
+
568
+ }
569
+ var pop = arr.pop;
570
+
571
+
572
+ var sort = arr.sort;
573
+
574
+
575
+ var splice = arr.splice;
576
+
577
+
578
+ var whitespace = "[\\x20\\t\\r\\n\\f]";
579
+
580
+
581
+ var rtrimCSS = new RegExp(
582
+ "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$",
583
+ "g"
584
+ );
585
+
586
+
587
+
588
+
589
+ // Note: an element does not contain itself
590
+ jQuery.contains = function( a, b ) {
591
+ var bup = b && b.parentNode;
592
+
593
+ return a === bup || !!( bup && bup.nodeType === 1 && (
594
+
595
+ // Support: IE 9 - 11+
596
+ // IE doesn't have `contains` on SVG.
597
+ a.contains ?
598
+ a.contains( bup ) :
599
+ a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
600
+ ) );
601
+ };
602
+
603
+
604
+
605
+
606
+ // CSS string/identifier serialization
607
+ // https://drafts.csswg.org/cssom/#common-serializing-idioms
608
+ var rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\x80-\uFFFF\w-]/g;
609
+
610
+ function fcssescape( ch, asCodePoint ) {
611
+ if ( asCodePoint ) {
612
+
613
+ // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER
614
+ if ( ch === "\0" ) {
615
+ return "\uFFFD";
616
+ }
617
+
618
+ // Control characters and (dependent upon position) numbers get escaped as code points
619
+ return ch.slice( 0, -1 ) + "\\" + ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " ";
620
+ }
621
+
622
+ // Other potentially-special ASCII characters get backslash-escaped
623
+ return "\\" + ch;
624
+ }
625
+
626
+ jQuery.escapeSelector = function( sel ) {
627
+ return ( sel + "" ).replace( rcssescape, fcssescape );
628
+ };
629
+
630
+
631
+
632
+
633
+ var preferredDoc = document,
634
+ pushNative = push;
635
+
636
+ ( function() {
637
+
535
638
  var i,
536
- support,
537
639
  Expr,
538
- getText,
539
- isXML,
540
- tokenize,
541
- compile,
542
- select,
543
640
  outermostContext,
544
641
  sortInput,
545
642
  hasDuplicate,
643
+ push = pushNative,
546
644
 
547
645
  // Local document vars
548
- setDocument,
549
646
  document,
550
- docElem,
647
+ documentElement,
551
648
  documentIsHTML,
552
649
  rbuggyQSA,
553
- rbuggyMatches,
554
650
  matches,
555
- contains,
556
651
 
557
652
  // Instance-specific data
558
- expando = "sizzle" + 1 * new Date(),
559
- preferredDoc = window.document,
653
+ expando = jQuery.expando,
560
654
  dirruns = 0,
561
655
  done = 0,
562
656
  classCache = createCache(),
@@ -570,47 +664,22 @@ var i,
570
664
  return 0;
571
665
  },
572
666
 
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",
667
+ booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|" +
668
+ "loop|multiple|open|readonly|required|scoped",
596
669
 
597
670
  // Regular expressions
598
671
 
599
- // http://www.w3.org/TR/css3-selectors/#whitespace
600
- whitespace = "[\\x20\\t\\r\\n\\f]",
601
-
602
672
  // https://www.w3.org/TR/css-syntax-3/#ident-token-diagram
603
673
  identifier = "(?:\\\\[\\da-fA-F]{1,6}" + whitespace +
604
674
  "?|\\\\[^\\r\\n\\f]|[\\w-]|[^\0-\\x7f])+",
605
675
 
606
- // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors
676
+ // Attribute selectors: https://www.w3.org/TR/selectors/#attribute-selectors
607
677
  attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace +
608
678
 
609
679
  // Operator (capture 2)
610
680
  "*([*^$|!~]?=)" + whitespace +
611
681
 
612
- // "Attribute values must be CSS identifiers [capture 5]
613
- // or strings [capture 3 or capture 4]"
682
+ // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]"
614
683
  "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" +
615
684
  whitespace + "*\\]",
616
685
 
@@ -629,101 +698,88 @@ var i,
629
698
 
630
699
  // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
631
700
  rwhitespace = new RegExp( whitespace + "+", "g" ),
632
- rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" +
633
- whitespace + "+$", "g" ),
634
701
 
635
702
  rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
636
- rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace +
637
- "*" ),
703
+ rleadingCombinator = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" +
704
+ whitespace + "*" ),
638
705
  rdescend = new RegExp( whitespace + "|>" ),
639
706
 
640
707
  rpseudo = new RegExp( pseudos ),
641
708
  ridentifier = new RegExp( "^" + identifier + "$" ),
642
709
 
643
710
  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" ),
711
+ ID: new RegExp( "^#(" + identifier + ")" ),
712
+ CLASS: new RegExp( "^\\.(" + identifier + ")" ),
713
+ TAG: new RegExp( "^(" + identifier + "|[*])" ),
714
+ ATTR: new RegExp( "^" + attributes ),
715
+ PSEUDO: new RegExp( "^" + pseudos ),
716
+ CHILD: new RegExp(
717
+ "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" +
718
+ whitespace + "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" +
719
+ whitespace + "*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
720
+ bool: new RegExp( "^(?:" + booleans + ")$", "i" ),
653
721
 
654
722
  // For use in libraries implementing .is()
655
723
  // We use this for POS matching in `select`
656
- "needsContext": new RegExp( "^" + whitespace +
724
+ needsContext: new RegExp( "^" + whitespace +
657
725
  "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + whitespace +
658
726
  "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )
659
727
  },
660
728
 
661
- rhtml = /HTML$/i,
662
729
  rinputs = /^(?:input|select|textarea|button)$/i,
663
730
  rheader = /^h\d$/i,
664
731
 
665
- rnative = /^[^{]+\{\s*\[native \w/,
666
-
667
732
  // Easily-parseable/retrievable ID or TAG or CLASS selectors
668
733
  rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
669
734
 
670
735
  rsibling = /[+~]/,
671
736
 
672
737
  // 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" ),
738
+ // https://www.w3.org/TR/CSS21/syndata.html#escaped-characters
739
+ runescape = new RegExp( "\\\\[\\da-fA-F]{1,6}" + whitespace +
740
+ "?|\\\\([^\\r\\n\\f])", "g" ),
675
741
  funescape = function( escape, nonHex ) {
676
742
  var high = "0x" + escape.slice( 1 ) - 0x10000;
677
743
 
678
- return nonHex ?
744
+ if ( nonHex ) {
679
745
 
680
746
  // 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 ) + " ";
747
+ return nonHex;
706
748
  }
707
749
 
708
- // Other potentially-special ASCII characters get backslash-escaped
709
- return "\\" + ch;
750
+ // Replace a hexadecimal escape sequence with the encoded Unicode code point
751
+ // Support: IE <=11+
752
+ // For values outside the Basic Multilingual Plane (BMP), manually construct a
753
+ // surrogate pair
754
+ return high < 0 ?
755
+ String.fromCharCode( high + 0x10000 ) :
756
+ String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
710
757
  },
711
758
 
712
- // Used for iframes
713
- // See setDocument()
759
+ // Used for iframes; see `setDocument`.
760
+ // Support: IE 9 - 11+, Edge 12 - 18+
714
761
  // Removing the function wrapper causes a "Permission Denied"
715
- // error in IE
762
+ // error in IE/Edge.
716
763
  unloadHandler = function() {
717
764
  setDocument();
718
765
  },
719
766
 
720
767
  inDisabledFieldset = addCombinator(
721
768
  function( elem ) {
722
- return elem.disabled === true && elem.nodeName.toLowerCase() === "fieldset";
769
+ return elem.disabled === true && nodeName( elem, "fieldset" );
723
770
  },
724
771
  { dir: "parentNode", next: "legend" }
725
772
  );
726
773
 
774
+ // Support: IE <=9 only
775
+ // Accessing document.activeElement can throw unexpectedly
776
+ // https://bugs.jquery.com/ticket/13393
777
+ function safeActiveElement() {
778
+ try {
779
+ return document.activeElement;
780
+ } catch ( err ) { }
781
+ }
782
+
727
783
  // Optimize for push.apply( _, NodeList )
728
784
  try {
729
785
  push.apply(
@@ -731,32 +787,22 @@ try {
731
787
  preferredDoc.childNodes
732
788
  );
733
789
 
734
- // Support: Android<4.0
790
+ // Support: Android <=4.0
735
791
  // Detect silently failing push.apply
736
792
  // eslint-disable-next-line no-unused-expressions
737
793
  arr[ preferredDoc.childNodes.length ].nodeType;
738
794
  } catch ( e ) {
739
- push = { apply: arr.length ?
740
-
741
- // Leverage slice if possible
742
- function( target, els ) {
795
+ push = {
796
+ apply: function( target, els ) {
743
797
  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;
798
+ },
799
+ call: function( target ) {
800
+ pushNative.apply( target, slice.call( arguments, 1 ) );
755
801
  }
756
802
  };
757
803
  }
758
804
 
759
- function Sizzle( selector, context, results, seed ) {
805
+ function find( selector, context, results, seed ) {
760
806
  var m, i, elem, nid, match, groups, newSelector,
761
807
  newContext = context && context.ownerDocument,
762
808
 
@@ -790,11 +836,10 @@ function Sizzle( selector, context, results, seed ) {
790
836
  if ( nodeType === 9 ) {
791
837
  if ( ( elem = context.getElementById( m ) ) ) {
792
838
 
793
- // Support: IE, Opera, Webkit
794
- // TODO: identify versions
839
+ // Support: IE 9 only
795
840
  // getElementById can match elements by name instead of ID
796
841
  if ( elem.id === m ) {
797
- results.push( elem );
842
+ push.call( results, elem );
798
843
  return results;
799
844
  }
800
845
  } else {
@@ -804,14 +849,13 @@ function Sizzle( selector, context, results, seed ) {
804
849
  // Element context
805
850
  } else {
806
851
 
807
- // Support: IE, Opera, Webkit
808
- // TODO: identify versions
852
+ // Support: IE 9 only
809
853
  // getElementById can match elements by name instead of ID
810
854
  if ( newContext && ( elem = newContext.getElementById( m ) ) &&
811
- contains( context, elem ) &&
855
+ find.contains( context, elem ) &&
812
856
  elem.id === m ) {
813
857
 
814
- results.push( elem );
858
+ push.call( results, elem );
815
859
  return results;
816
860
  }
817
861
  }
@@ -822,22 +866,15 @@ function Sizzle( selector, context, results, seed ) {
822
866
  return results;
823
867
 
824
868
  // Class selector
825
- } else if ( ( m = match[ 3 ] ) && support.getElementsByClassName &&
826
- context.getElementsByClassName ) {
827
-
869
+ } else if ( ( m = match[ 3 ] ) && context.getElementsByClassName ) {
828
870
  push.apply( results, context.getElementsByClassName( m ) );
829
871
  return results;
830
872
  }
831
873
  }
832
874
 
833
875
  // 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" ) ) {
876
+ if ( !nonnativeSelectorCache[ selector + " " ] &&
877
+ ( !rbuggyQSA || !rbuggyQSA.test( selector ) ) ) {
841
878
 
842
879
  newSelector = selector;
843
880
  newContext = context;
@@ -850,7 +887,7 @@ function Sizzle( selector, context, results, seed ) {
850
887
  // as such selectors are not recognized by querySelectorAll.
851
888
  // Thanks to Andrew Dupont for this technique.
852
889
  if ( nodeType === 1 &&
853
- ( rdescend.test( selector ) || rcombinators.test( selector ) ) ) {
890
+ ( rdescend.test( selector ) || rleadingCombinator.test( selector ) ) ) {
854
891
 
855
892
  // Expand context for sibling selectors
856
893
  newContext = rsibling.test( selector ) && testContext( context.parentNode ) ||
@@ -858,11 +895,15 @@ function Sizzle( selector, context, results, seed ) {
858
895
 
859
896
  // We can use :scope instead of the ID hack if the browser
860
897
  // supports it & if we're not changing the context.
861
- if ( newContext !== context || !support.scope ) {
898
+ // Support: IE 11+, Edge 17 - 18+
899
+ // IE/Edge sometimes throw a "Permission denied" error when
900
+ // strict-comparing two documents; shallow comparisons work.
901
+ // eslint-disable-next-line eqeqeq
902
+ if ( newContext != context || !support.scope ) {
862
903
 
863
904
  // Capture the context ID, setting it first if necessary
864
905
  if ( ( nid = context.getAttribute( "id" ) ) ) {
865
- nid = nid.replace( rcssescape, fcssescape );
906
+ nid = jQuery.escapeSelector( nid );
866
907
  } else {
867
908
  context.setAttribute( "id", ( nid = expando ) );
868
909
  }
@@ -895,7 +936,7 @@ function Sizzle( selector, context, results, seed ) {
895
936
  }
896
937
 
897
938
  // All others
898
- return select( selector.replace( rtrim, "$1" ), context, results, seed );
939
+ return select( selector.replace( rtrimCSS, "$1" ), context, results, seed );
899
940
  }
900
941
 
901
942
  /**
@@ -909,7 +950,8 @@ function createCache() {
909
950
 
910
951
  function cache( key, value ) {
911
952
 
912
- // Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
953
+ // Use (key + " ") to avoid collision with native prototype properties
954
+ // (see https://github.com/jquery/sizzle/issues/157)
913
955
  if ( keys.push( key + " " ) > Expr.cacheLength ) {
914
956
 
915
957
  // Only keep the most recent entries
@@ -921,7 +963,7 @@ function createCache() {
921
963
  }
922
964
 
923
965
  /**
924
- * Mark a function for special use by Sizzle
966
+ * Mark a function for special use by jQuery selector module
925
967
  * @param {Function} fn The function to mark
926
968
  */
927
969
  function markFunction( fn ) {
@@ -952,56 +994,13 @@ function assert( fn ) {
952
994
  }
953
995
  }
954
996
 
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
997
  /**
998
998
  * Returns a function to use in pseudos for input types
999
999
  * @param {String} type
1000
1000
  */
1001
1001
  function createInputPseudo( type ) {
1002
1002
  return function( elem ) {
1003
- var name = elem.nodeName.toLowerCase();
1004
- return name === "input" && elem.type === type;
1003
+ return nodeName( elem, "input" ) && elem.type === type;
1005
1004
  };
1006
1005
  }
1007
1006
 
@@ -1011,8 +1010,8 @@ function createInputPseudo( type ) {
1011
1010
  */
1012
1011
  function createButtonPseudo( type ) {
1013
1012
  return function( elem ) {
1014
- var name = elem.nodeName.toLowerCase();
1015
- return ( name === "input" || name === "button" ) && elem.type === type;
1013
+ return ( nodeName( elem, "input" ) || nodeName( elem, "button" ) ) &&
1014
+ elem.type === type;
1016
1015
  };
1017
1016
  }
1018
1017
 
@@ -1048,14 +1047,13 @@ function createDisabledPseudo( disabled ) {
1048
1047
  }
1049
1048
  }
1050
1049
 
1051
- // Support: IE 6 - 11
1050
+ // Support: IE 6 - 11+
1052
1051
  // Use the isDisabled shortcut property to check for disabled fieldset ancestors
1053
1052
  return elem.isDisabled === disabled ||
1054
1053
 
1055
1054
  // Where there is no isDisabled, check manually
1056
- /* jshint -W018 */
1057
1055
  elem.isDisabled !== !disabled &&
1058
- inDisabledFieldset( elem ) === disabled;
1056
+ inDisabledFieldset( elem ) === disabled;
1059
1057
  }
1060
1058
 
1061
1059
  return elem.disabled === disabled;
@@ -1095,7 +1093,7 @@ function createPositionalPseudo( fn ) {
1095
1093
  }
1096
1094
 
1097
1095
  /**
1098
- * Checks a node for validity as a Sizzle context
1096
+ * Checks a node for validity as a jQuery selector context
1099
1097
  * @param {Element|Object=} context
1100
1098
  * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value
1101
1099
  */
@@ -1103,31 +1101,13 @@ function testContext( context ) {
1103
1101
  return context && typeof context.getElementsByTagName !== "undefined" && context;
1104
1102
  }
1105
1103
 
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
1104
  /**
1125
1105
  * 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
1106
+ * @param {Element|Object} [node] An element or document object to use to set the document
1127
1107
  * @returns {Object} Returns the current document
1128
1108
  */
1129
- setDocument = Sizzle.setDocument = function( node ) {
1130
- var hasCompare, subWindow,
1109
+ function setDocument( node ) {
1110
+ var subWindow,
1131
1111
  doc = node ? node.ownerDocument || node : preferredDoc;
1132
1112
 
1133
1113
  // Return early if doc is invalid or already selected
@@ -1141,87 +1121,90 @@ setDocument = Sizzle.setDocument = function( node ) {
1141
1121
 
1142
1122
  // Update global variables
1143
1123
  document = doc;
1144
- docElem = document.documentElement;
1145
- documentIsHTML = !isXML( document );
1124
+ documentElement = document.documentElement;
1125
+ documentIsHTML = !jQuery.isXMLDoc( document );
1126
+
1127
+ // Support: iOS 7 only, IE 9 - 11+
1128
+ // Older browsers didn't support unprefixed `matches`.
1129
+ matches = documentElement.matches ||
1130
+ documentElement.webkitMatchesSelector ||
1131
+ documentElement.msMatchesSelector;
1146
1132
 
1147
1133
  // Support: IE 9 - 11+, Edge 12 - 18+
1148
- // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936)
1149
- // Support: IE 11+, Edge 17 - 18+
1150
- // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
1151
- // two documents; shallow comparisons work.
1152
- // eslint-disable-next-line eqeqeq
1153
- if ( preferredDoc != document &&
1154
- ( subWindow = document.defaultView ) && subWindow.top !== subWindow ) {
1134
+ // Accessing iframe documents after unload throws "permission denied" errors
1135
+ // (see trac-13936).
1136
+ // Limit the fix to IE & Edge Legacy; despite Edge 15+ implementing `matches`,
1137
+ // all IE 9+ and Edge Legacy versions implement `msMatchesSelector` as well.
1138
+ if ( documentElement.msMatchesSelector &&
1155
1139
 
1156
- // Support: IE 11, Edge
1157
- if ( subWindow.addEventListener ) {
1158
- subWindow.addEventListener( "unload", unloadHandler, false );
1140
+ // Support: IE 11+, Edge 17 - 18+
1141
+ // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
1142
+ // two documents; shallow comparisons work.
1143
+ // eslint-disable-next-line eqeqeq
1144
+ preferredDoc != document &&
1145
+ ( subWindow = document.defaultView ) && subWindow.top !== subWindow ) {
1159
1146
 
1160
- // Support: IE 9 - 10 only
1161
- } else if ( subWindow.attachEvent ) {
1162
- subWindow.attachEvent( "onunload", unloadHandler );
1163
- }
1147
+ // Support: IE 9 - 11+, Edge 12 - 18+
1148
+ subWindow.addEventListener( "unload", unloadHandler );
1164
1149
  }
1165
1150
 
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;
1151
+ // Support: IE <10
1152
+ // Check if getElementById returns elements by name
1153
+ // The broken getElementById methods don't pick up programmatically-set names,
1154
+ // so use a roundabout getElementsByName test
1155
+ support.getById = assert( function( el ) {
1156
+ documentElement.appendChild( el ).id = jQuery.expando;
1157
+ return !document.getElementsByName ||
1158
+ !document.getElementsByName( jQuery.expando ).length;
1175
1159
  } );
1176
1160
 
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" );
1161
+ // Support: IE 9 only
1162
+ // Check to see if it's possible to do matchesSelector
1163
+ // on a disconnected node.
1164
+ support.disconnectedMatch = assert( function( el ) {
1165
+ return matches.call( el, "*" );
1186
1166
  } );
1187
1167
 
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;
1168
+ // Support: IE 9 - 11+, Edge 12 - 18+
1169
+ // IE/Edge don't support the :scope pseudo-class.
1170
+ support.scope = assert( function() {
1171
+ return document.querySelectorAll( ":scope" );
1195
1172
  } );
1196
1173
 
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;
1174
+ // Support: Chrome 105 - 111 only, Safari 15.4 - 16.3 only
1175
+ // Make sure the `:has()` argument is parsed unforgivingly.
1176
+ // We include `*` in the test to detect buggy implementations that are
1177
+ // _selectively_ forgiving (specifically when the list includes at least
1178
+ // one valid selector).
1179
+ // Note that we treat complete lack of support for `:has()` as if it were
1180
+ // spec-compliant support, which is fine because use of `:has()` in such
1181
+ // environments will fail in the qSA path and fall back to jQuery traversal
1182
+ // anyway.
1183
+ support.cssHas = assert( function() {
1184
+ try {
1185
+ document.querySelector( ":has(*,:jqfake)" );
1186
+ return false;
1187
+ } catch ( e ) {
1188
+ return true;
1189
+ }
1207
1190
  } );
1208
1191
 
1209
1192
  // ID filter and find
1210
1193
  if ( support.getById ) {
1211
- Expr.filter[ "ID" ] = function( id ) {
1194
+ Expr.filter.ID = function( id ) {
1212
1195
  var attrId = id.replace( runescape, funescape );
1213
1196
  return function( elem ) {
1214
1197
  return elem.getAttribute( "id" ) === attrId;
1215
1198
  };
1216
1199
  };
1217
- Expr.find[ "ID" ] = function( id, context ) {
1200
+ Expr.find.ID = function( id, context ) {
1218
1201
  if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
1219
1202
  var elem = context.getElementById( id );
1220
1203
  return elem ? [ elem ] : [];
1221
1204
  }
1222
1205
  };
1223
1206
  } else {
1224
- Expr.filter[ "ID" ] = function( id ) {
1207
+ Expr.filter.ID = function( id ) {
1225
1208
  var attrId = id.replace( runescape, funescape );
1226
1209
  return function( elem ) {
1227
1210
  var node = typeof elem.getAttributeNode !== "undefined" &&
@@ -1232,7 +1215,7 @@ setDocument = Sizzle.setDocument = function( node ) {
1232
1215
 
1233
1216
  // Support: IE 6 - 7 only
1234
1217
  // getElementById is not reliable as a find shortcut
1235
- Expr.find[ "ID" ] = function( id, context ) {
1218
+ Expr.find.ID = function( id, context ) {
1236
1219
  if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
1237
1220
  var node, i, elems,
1238
1221
  elem = context.getElementById( id );
@@ -1262,40 +1245,18 @@ setDocument = Sizzle.setDocument = function( node ) {
1262
1245
  }
1263
1246
 
1264
1247
  // Tag
1265
- Expr.find[ "TAG" ] = support.getElementsByTagName ?
1266
- function( tag, context ) {
1267
- if ( typeof context.getElementsByTagName !== "undefined" ) {
1268
- return context.getElementsByTagName( tag );
1269
-
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
- }
1248
+ Expr.find.TAG = function( tag, context ) {
1249
+ if ( typeof context.getElementsByTagName !== "undefined" ) {
1250
+ return context.getElementsByTagName( tag );
1291
1251
 
1292
- return tmp;
1293
- }
1294
- return results;
1295
- };
1252
+ // DocumentFragment nodes don't have gEBTN
1253
+ } else {
1254
+ return context.querySelectorAll( tag );
1255
+ }
1256
+ };
1296
1257
 
1297
1258
  // Class
1298
- Expr.find[ "CLASS" ] = support.getElementsByClassName && function( className, context ) {
1259
+ Expr.find.CLASS = function( className, context ) {
1299
1260
  if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) {
1300
1261
  return context.getElementsByClassName( className );
1301
1262
  }
@@ -1306,177 +1267,94 @@ setDocument = Sizzle.setDocument = function( node ) {
1306
1267
 
1307
1268
  // QSA and matchesSelector support
1308
1269
 
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
1270
  rbuggyQSA = [];
1318
1271
 
1319
- if ( ( support.qsa = rnative.test( document.querySelectorAll ) ) ) {
1272
+ // Build QSA regex
1273
+ // Regex strategy adopted from Diego Perini
1274
+ assert( function( el ) {
1320
1275
 
1321
- // Build QSA regex
1322
- // Regex strategy adopted from Diego Perini
1323
- assert( function( el ) {
1276
+ var input;
1324
1277
 
1325
- var input;
1278
+ documentElement.appendChild( el ).innerHTML =
1279
+ "<a id='" + expando + "' href='' disabled='disabled'></a>" +
1280
+ "<select id='" + expando + "-\r\\' disabled='disabled'>" +
1281
+ "<option selected=''></option></select>";
1326
1282
 
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>";
1391
-
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" );
1397
-
1398
- // Support: IE8
1399
- // Enforce case-sensitivity of name attribute
1400
- if ( el.querySelectorAll( "[name=d]" ).length ) {
1401
- rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" );
1402
- }
1403
-
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
- }
1283
+ // Support: iOS <=7 - 8 only
1284
+ // Boolean attributes and "value" are not treated correctly in some XML documents
1285
+ if ( !el.querySelectorAll( "[selected]" ).length ) {
1286
+ rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" );
1287
+ }
1409
1288
 
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
- }
1289
+ // Support: iOS <=7 - 8 only
1290
+ if ( !el.querySelectorAll( "[id~=" + expando + "-]" ).length ) {
1291
+ rbuggyQSA.push( "~=" );
1292
+ }
1416
1293
 
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
- }
1294
+ // Support: iOS 8 only
1295
+ // https://bugs.webkit.org/show_bug.cgi?id=136851
1296
+ // In-page `selector#id sibling-combinator selector` fails
1297
+ if ( !el.querySelectorAll( "a#" + expando + "+*" ).length ) {
1298
+ rbuggyQSA.push( ".#.+[+~]" );
1299
+ }
1423
1300
 
1424
- if ( ( support.matchesSelector = rnative.test( ( matches = docElem.matches ||
1425
- docElem.webkitMatchesSelector ||
1426
- docElem.mozMatchesSelector ||
1427
- docElem.oMatchesSelector ||
1428
- docElem.msMatchesSelector ) ) ) ) {
1301
+ // Support: Chrome <=105+, Firefox <=104+, Safari <=15.4+
1302
+ // In some of the document kinds, these selectors wouldn't work natively.
1303
+ // This is probably OK but for backwards compatibility we want to maintain
1304
+ // handling them through jQuery traversal in jQuery 3.x.
1305
+ if ( !el.querySelectorAll( ":checked" ).length ) {
1306
+ rbuggyQSA.push( ":checked" );
1307
+ }
1429
1308
 
1430
- assert( function( el ) {
1309
+ // Support: Windows 8 Native Apps
1310
+ // The type and name attributes are restricted during .innerHTML assignment
1311
+ input = document.createElement( "input" );
1312
+ input.setAttribute( "type", "hidden" );
1313
+ el.appendChild( input ).setAttribute( "name", "D" );
1314
+
1315
+ // Support: IE 9 - 11+
1316
+ // IE's :disabled selector does not pick up the children of disabled fieldsets
1317
+ // Support: Chrome <=105+, Firefox <=104+, Safari <=15.4+
1318
+ // In some of the document kinds, these selectors wouldn't work natively.
1319
+ // This is probably OK but for backwards compatibility we want to maintain
1320
+ // handling them through jQuery traversal in jQuery 3.x.
1321
+ documentElement.appendChild( el ).disabled = true;
1322
+ if ( el.querySelectorAll( ":disabled" ).length !== 2 ) {
1323
+ rbuggyQSA.push( ":enabled", ":disabled" );
1324
+ }
1325
+
1326
+ // Support: IE 11+, Edge 15 - 18+
1327
+ // IE 11/Edge don't find elements on a `[name='']` query in some cases.
1328
+ // Adding a temporary attribute to the document before the selection works
1329
+ // around the issue.
1330
+ // Interestingly, IE 10 & older don't seem to have the issue.
1331
+ input = document.createElement( "input" );
1332
+ input.setAttribute( "name", "" );
1333
+ el.appendChild( input );
1334
+ if ( !el.querySelectorAll( "[name='']" ).length ) {
1335
+ rbuggyQSA.push( "\\[" + whitespace + "*name" + whitespace + "*=" +
1336
+ whitespace + "*(?:''|\"\")" );
1337
+ }
1338
+ } );
1431
1339
 
1432
- // Check to see if it's possible to do matchesSelector
1433
- // on a disconnected node (IE 9)
1434
- support.disconnectedMatch = matches.call( el, "*" );
1340
+ if ( !support.cssHas ) {
1435
1341
 
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
- } );
1342
+ // Support: Chrome 105 - 110+, Safari 15.4 - 16.3+
1343
+ // Our regular `try-catch` mechanism fails to detect natively-unsupported
1344
+ // pseudo-classes inside `:has()` (such as `:has(:contains("Foo"))`)
1345
+ // in browsers that parse the `:has()` argument as a forgiving selector list.
1346
+ // https://drafts.csswg.org/selectors/#relational now requires the argument
1347
+ // to be parsed unforgivingly, but browsers have not yet fully adjusted.
1348
+ rbuggyQSA.push( ":has" );
1441
1349
  }
1442
1350
 
1443
1351
  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
1352
 
1474
1353
  /* Sorting
1475
1354
  ---------------------------------------------------------------------- */
1476
1355
 
1477
1356
  // Document order sorting
1478
- sortOrder = hasCompare ?
1479
- function( a, b ) {
1357
+ sortOrder = function( a, b ) {
1480
1358
 
1481
1359
  // Flag for duplicate removal
1482
1360
  if ( a === b ) {
@@ -1510,8 +1388,8 @@ setDocument = Sizzle.setDocument = function( node ) {
1510
1388
  // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
1511
1389
  // two documents; shallow comparisons work.
1512
1390
  // eslint-disable-next-line eqeqeq
1513
- if ( a == document || a.ownerDocument == preferredDoc &&
1514
- contains( preferredDoc, a ) ) {
1391
+ if ( a === document || a.ownerDocument == preferredDoc &&
1392
+ find.contains( preferredDoc, a ) ) {
1515
1393
  return -1;
1516
1394
  }
1517
1395
 
@@ -1519,100 +1397,33 @@ setDocument = Sizzle.setDocument = function( node ) {
1519
1397
  // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
1520
1398
  // two documents; shallow comparisons work.
1521
1399
  // eslint-disable-next-line eqeqeq
1522
- if ( b == document || b.ownerDocument == preferredDoc &&
1523
- contains( preferredDoc, b ) ) {
1400
+ if ( b === document || b.ownerDocument == preferredDoc &&
1401
+ find.contains( preferredDoc, b ) ) {
1524
1402
  return 1;
1525
1403
  }
1526
1404
 
1527
1405
  // Maintain original order
1528
1406
  return sortInput ?
1529
- ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
1407
+ ( indexOf.call( sortInput, a ) - indexOf.call( sortInput, b ) ) :
1530
1408
  0;
1531
1409
  }
1532
1410
 
1533
1411
  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
1412
  };
1601
1413
 
1602
1414
  return document;
1603
- };
1415
+ }
1604
1416
 
1605
- Sizzle.matches = function( expr, elements ) {
1606
- return Sizzle( expr, null, null, elements );
1417
+ find.matches = function( expr, elements ) {
1418
+ return find( expr, null, null, elements );
1607
1419
  };
1608
1420
 
1609
- Sizzle.matchesSelector = function( elem, expr ) {
1421
+ find.matchesSelector = function( elem, expr ) {
1610
1422
  setDocument( elem );
1611
1423
 
1612
- if ( support.matchesSelector && documentIsHTML &&
1424
+ if ( documentIsHTML &&
1613
1425
  !nonnativeSelectorCache[ expr + " " ] &&
1614
- ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) &&
1615
- ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) {
1426
+ ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) {
1616
1427
 
1617
1428
  try {
1618
1429
  var ret = matches.call( elem, expr );
@@ -1620,9 +1431,9 @@ Sizzle.matchesSelector = function( elem, expr ) {
1620
1431
  // IE 9's matchesSelector returns false on disconnected nodes
1621
1432
  if ( ret || support.disconnectedMatch ||
1622
1433
 
1623
- // As well, disconnected nodes are said to be in a document
1624
- // fragment in IE 9
1625
- elem.document && elem.document.nodeType !== 11 ) {
1434
+ // As well, disconnected nodes are said to be in a document
1435
+ // fragment in IE 9
1436
+ elem.document && elem.document.nodeType !== 11 ) {
1626
1437
  return ret;
1627
1438
  }
1628
1439
  } catch ( e ) {
@@ -1630,10 +1441,10 @@ Sizzle.matchesSelector = function( elem, expr ) {
1630
1441
  }
1631
1442
  }
1632
1443
 
1633
- return Sizzle( expr, document, null, [ elem ] ).length > 0;
1444
+ return find( expr, document, null, [ elem ] ).length > 0;
1634
1445
  };
1635
1446
 
1636
- Sizzle.contains = function( context, elem ) {
1447
+ find.contains = function( context, elem ) {
1637
1448
 
1638
1449
  // Set document vars if needed
1639
1450
  // Support: IE 11+, Edge 17 - 18+
@@ -1643,10 +1454,11 @@ Sizzle.contains = function( context, elem ) {
1643
1454
  if ( ( context.ownerDocument || context ) != document ) {
1644
1455
  setDocument( context );
1645
1456
  }
1646
- return contains( context, elem );
1457
+ return jQuery.contains( context, elem );
1647
1458
  };
1648
1459
 
1649
- Sizzle.attr = function( elem, name ) {
1460
+
1461
+ find.attr = function( elem, name ) {
1650
1462
 
1651
1463
  // Set document vars if needed
1652
1464
  // Support: IE 11+, Edge 17 - 18+
@@ -1659,25 +1471,19 @@ Sizzle.attr = function( elem, name ) {
1659
1471
 
1660
1472
  var fn = Expr.attrHandle[ name.toLowerCase() ],
1661
1473
 
1662
- // Don't get fooled by Object.prototype properties (jQuery #13807)
1474
+ // Don't get fooled by Object.prototype properties (see trac-13807)
1663
1475
  val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ?
1664
1476
  fn( elem, name, !documentIsHTML ) :
1665
1477
  undefined;
1666
1478
 
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
- };
1479
+ if ( val !== undefined ) {
1480
+ return val;
1481
+ }
1675
1482
 
1676
- Sizzle.escape = function( sel ) {
1677
- return ( sel + "" ).replace( rcssescape, fcssescape );
1483
+ return elem.getAttribute( name );
1678
1484
  };
1679
1485
 
1680
- Sizzle.error = function( msg ) {
1486
+ find.error = function( msg ) {
1681
1487
  throw new Error( "Syntax error, unrecognized expression: " + msg );
1682
1488
  };
1683
1489
 
@@ -1685,76 +1491,44 @@ Sizzle.error = function( msg ) {
1685
1491
  * Document sorting and removing duplicates
1686
1492
  * @param {ArrayLike} results
1687
1493
  */
1688
- Sizzle.uniqueSort = function( results ) {
1494
+ jQuery.uniqueSort = function( results ) {
1689
1495
  var elem,
1690
1496
  duplicates = [],
1691
1497
  j = 0,
1692
1498
  i = 0;
1693
1499
 
1694
1500
  // 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 );
1501
+ //
1502
+ // Support: Android <=4.0+
1503
+ // Testing for detecting duplicates is unpredictable so instead assume we can't
1504
+ // depend on duplicate detection in all browsers without a stable sort.
1505
+ hasDuplicate = !support.sortStable;
1506
+ sortInput = !support.sortStable && slice.call( results, 0 );
1507
+ sort.call( results, sortOrder );
1698
1508
 
1699
1509
  if ( hasDuplicate ) {
1700
- while ( ( elem = results[ i++ ] ) ) {
1701
- if ( elem === results[ i ] ) {
1702
- j = duplicates.push( i );
1703
- }
1704
- }
1705
- while ( j-- ) {
1706
- results.splice( duplicates[ j ], 1 );
1707
- }
1708
- }
1709
-
1710
- // Clear input after sorting to release objects
1711
- // See https://github.com/jquery/sizzle/pull/225
1712
- sortInput = null;
1713
-
1714
- return results;
1715
- };
1716
-
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 );
1510
+ while ( ( elem = results[ i++ ] ) ) {
1511
+ if ( elem === results[ i ] ) {
1512
+ j = duplicates.push( i );
1746
1513
  }
1747
1514
  }
1748
- } else if ( nodeType === 3 || nodeType === 4 ) {
1749
- return elem.nodeValue;
1515
+ while ( j-- ) {
1516
+ splice.call( results, duplicates[ j ], 1 );
1517
+ }
1750
1518
  }
1751
1519
 
1752
- // Do not include comment or processing instruction nodes
1520
+ // Clear input after sorting to release objects
1521
+ // See https://github.com/jquery/sizzle/pull/225
1522
+ sortInput = null;
1523
+
1524
+ return results;
1525
+ };
1753
1526
 
1754
- return ret;
1527
+ jQuery.fn.uniqueSort = function() {
1528
+ return this.pushStack( jQuery.uniqueSort( slice.apply( this ) ) );
1755
1529
  };
1756
1530
 
1757
- Expr = Sizzle.selectors = {
1531
+ Expr = jQuery.expr = {
1758
1532
 
1759
1533
  // Can be adjusted by the user
1760
1534
  cacheLength: 50,
@@ -1775,12 +1549,12 @@ Expr = Sizzle.selectors = {
1775
1549
  },
1776
1550
 
1777
1551
  preFilter: {
1778
- "ATTR": function( match ) {
1552
+ ATTR: function( match ) {
1779
1553
  match[ 1 ] = match[ 1 ].replace( runescape, funescape );
1780
1554
 
1781
1555
  // Move the given value to match[3] whether quoted or unquoted
1782
- match[ 3 ] = ( match[ 3 ] || match[ 4 ] ||
1783
- match[ 5 ] || "" ).replace( runescape, funescape );
1556
+ match[ 3 ] = ( match[ 3 ] || match[ 4 ] || match[ 5 ] || "" )
1557
+ .replace( runescape, funescape );
1784
1558
 
1785
1559
  if ( match[ 2 ] === "~=" ) {
1786
1560
  match[ 3 ] = " " + match[ 3 ] + " ";
@@ -1789,7 +1563,7 @@ Expr = Sizzle.selectors = {
1789
1563
  return match.slice( 0, 4 );
1790
1564
  },
1791
1565
 
1792
- "CHILD": function( match ) {
1566
+ CHILD: function( match ) {
1793
1567
 
1794
1568
  /* matches from matchExpr["CHILD"]
1795
1569
  1 type (only|nth|...)
@@ -1807,29 +1581,30 @@ Expr = Sizzle.selectors = {
1807
1581
 
1808
1582
  // nth-* requires argument
1809
1583
  if ( !match[ 3 ] ) {
1810
- Sizzle.error( match[ 0 ] );
1584
+ find.error( match[ 0 ] );
1811
1585
  }
1812
1586
 
1813
1587
  // numeric x and y parameters for Expr.filter.CHILD
1814
1588
  // remember that false/true cast respectively to 0/1
1815
1589
  match[ 4 ] = +( match[ 4 ] ?
1816
1590
  match[ 5 ] + ( match[ 6 ] || 1 ) :
1817
- 2 * ( match[ 3 ] === "even" || match[ 3 ] === "odd" ) );
1591
+ 2 * ( match[ 3 ] === "even" || match[ 3 ] === "odd" )
1592
+ );
1818
1593
  match[ 5 ] = +( ( match[ 7 ] + match[ 8 ] ) || match[ 3 ] === "odd" );
1819
1594
 
1820
- // other types prohibit arguments
1595
+ // other types prohibit arguments
1821
1596
  } else if ( match[ 3 ] ) {
1822
- Sizzle.error( match[ 0 ] );
1597
+ find.error( match[ 0 ] );
1823
1598
  }
1824
1599
 
1825
1600
  return match;
1826
1601
  },
1827
1602
 
1828
- "PSEUDO": function( match ) {
1603
+ PSEUDO: function( match ) {
1829
1604
  var excess,
1830
1605
  unquoted = !match[ 6 ] && match[ 2 ];
1831
1606
 
1832
- if ( matchExpr[ "CHILD" ].test( match[ 0 ] ) ) {
1607
+ if ( matchExpr.CHILD.test( match[ 0 ] ) ) {
1833
1608
  return null;
1834
1609
  }
1835
1610
 
@@ -1858,36 +1633,36 @@ Expr = Sizzle.selectors = {
1858
1633
 
1859
1634
  filter: {
1860
1635
 
1861
- "TAG": function( nodeNameSelector ) {
1862
- var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase();
1636
+ TAG: function( nodeNameSelector ) {
1637
+ var expectedNodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase();
1863
1638
  return nodeNameSelector === "*" ?
1864
1639
  function() {
1865
1640
  return true;
1866
1641
  } :
1867
1642
  function( elem ) {
1868
- return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
1643
+ return nodeName( elem, expectedNodeName );
1869
1644
  };
1870
1645
  },
1871
1646
 
1872
- "CLASS": function( className ) {
1647
+ CLASS: function( className ) {
1873
1648
  var pattern = classCache[ className + " " ];
1874
1649
 
1875
1650
  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
- );
1651
+ ( pattern = new RegExp( "(^|" + whitespace + ")" + className +
1652
+ "(" + whitespace + "|$)" ) ) &&
1653
+ classCache( className, function( elem ) {
1654
+ return pattern.test(
1655
+ typeof elem.className === "string" && elem.className ||
1656
+ typeof elem.getAttribute !== "undefined" &&
1657
+ elem.getAttribute( "class" ) ||
1658
+ ""
1659
+ );
1885
1660
  } );
1886
1661
  },
1887
1662
 
1888
- "ATTR": function( name, operator, check ) {
1663
+ ATTR: function( name, operator, check ) {
1889
1664
  return function( elem ) {
1890
- var result = Sizzle.attr( elem, name );
1665
+ var result = find.attr( elem, name );
1891
1666
 
1892
1667
  if ( result == null ) {
1893
1668
  return operator === "!=";
@@ -1898,22 +1673,34 @@ Expr = Sizzle.selectors = {
1898
1673
 
1899
1674
  result += "";
1900
1675
 
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 */
1676
+ if ( operator === "=" ) {
1677
+ return result === check;
1678
+ }
1679
+ if ( operator === "!=" ) {
1680
+ return result !== check;
1681
+ }
1682
+ if ( operator === "^=" ) {
1683
+ return check && result.indexOf( check ) === 0;
1684
+ }
1685
+ if ( operator === "*=" ) {
1686
+ return check && result.indexOf( check ) > -1;
1687
+ }
1688
+ if ( operator === "$=" ) {
1689
+ return check && result.slice( -check.length ) === check;
1690
+ }
1691
+ if ( operator === "~=" ) {
1692
+ return ( " " + result.replace( rwhitespace, " " ) + " " )
1693
+ .indexOf( check ) > -1;
1694
+ }
1695
+ if ( operator === "|=" ) {
1696
+ return result === check || result.slice( 0, check.length + 1 ) === check + "-";
1697
+ }
1912
1698
 
1699
+ return false;
1913
1700
  };
1914
1701
  },
1915
1702
 
1916
- "CHILD": function( type, what, _argument, first, last ) {
1703
+ CHILD: function( type, what, _argument, first, last ) {
1917
1704
  var simple = type.slice( 0, 3 ) !== "nth",
1918
1705
  forward = type.slice( -4 ) !== "last",
1919
1706
  ofType = what === "of-type";
@@ -1926,7 +1713,7 @@ Expr = Sizzle.selectors = {
1926
1713
  } :
1927
1714
 
1928
1715
  function( elem, _context, xml ) {
1929
- var cache, uniqueCache, outerCache, node, nodeIndex, start,
1716
+ var cache, outerCache, node, nodeIndex, start,
1930
1717
  dir = simple !== forward ? "nextSibling" : "previousSibling",
1931
1718
  parent = elem.parentNode,
1932
1719
  name = ofType && elem.nodeName.toLowerCase(),
@@ -1941,7 +1728,7 @@ Expr = Sizzle.selectors = {
1941
1728
  node = elem;
1942
1729
  while ( ( node = node[ dir ] ) ) {
1943
1730
  if ( ofType ?
1944
- node.nodeName.toLowerCase() === name :
1731
+ nodeName( node, name ) :
1945
1732
  node.nodeType === 1 ) {
1946
1733
 
1947
1734
  return false;
@@ -1960,17 +1747,8 @@ Expr = Sizzle.selectors = {
1960
1747
  if ( forward && useCache ) {
1961
1748
 
1962
1749
  // 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 ] || [];
1750
+ outerCache = parent[ expando ] || ( parent[ expando ] = {} );
1751
+ cache = outerCache[ type ] || [];
1974
1752
  nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
1975
1753
  diff = nodeIndex && cache[ 2 ];
1976
1754
  node = nodeIndex && parent.childNodes[ nodeIndex ];
@@ -1982,7 +1760,7 @@ Expr = Sizzle.selectors = {
1982
1760
 
1983
1761
  // When found, cache indexes on `parent` and break
1984
1762
  if ( node.nodeType === 1 && ++diff && node === elem ) {
1985
- uniqueCache[ type ] = [ dirruns, nodeIndex, diff ];
1763
+ outerCache[ type ] = [ dirruns, nodeIndex, diff ];
1986
1764
  break;
1987
1765
  }
1988
1766
  }
@@ -1991,17 +1769,8 @@ Expr = Sizzle.selectors = {
1991
1769
 
1992
1770
  // Use previously-cached element index if available
1993
1771
  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 ] || [];
1772
+ outerCache = elem[ expando ] || ( elem[ expando ] = {} );
1773
+ cache = outerCache[ type ] || [];
2005
1774
  nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
2006
1775
  diff = nodeIndex;
2007
1776
  }
@@ -2015,7 +1784,7 @@ Expr = Sizzle.selectors = {
2015
1784
  ( diff = nodeIndex = 0 ) || start.pop() ) ) {
2016
1785
 
2017
1786
  if ( ( ofType ?
2018
- node.nodeName.toLowerCase() === name :
1787
+ nodeName( node, name ) :
2019
1788
  node.nodeType === 1 ) &&
2020
1789
  ++diff ) {
2021
1790
 
@@ -2023,13 +1792,7 @@ Expr = Sizzle.selectors = {
2023
1792
  if ( useCache ) {
2024
1793
  outerCache = node[ expando ] ||
2025
1794
  ( 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 ];
1795
+ outerCache[ type ] = [ dirruns, diff ];
2033
1796
  }
2034
1797
 
2035
1798
  if ( node === elem ) {
@@ -2047,19 +1810,19 @@ Expr = Sizzle.selectors = {
2047
1810
  };
2048
1811
  },
2049
1812
 
2050
- "PSEUDO": function( pseudo, argument ) {
1813
+ PSEUDO: function( pseudo, argument ) {
2051
1814
 
2052
1815
  // pseudo-class names are case-insensitive
2053
- // http://www.w3.org/TR/selectors/#pseudo-classes
1816
+ // https://www.w3.org/TR/selectors/#pseudo-classes
2054
1817
  // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
2055
1818
  // Remember that setFilters inherits from pseudos
2056
1819
  var args,
2057
1820
  fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||
2058
- Sizzle.error( "unsupported pseudo: " + pseudo );
1821
+ find.error( "unsupported pseudo: " + pseudo );
2059
1822
 
2060
1823
  // The user may use createPseudo to indicate that
2061
1824
  // arguments are needed to create the filter function
2062
- // just as Sizzle does
1825
+ // just as jQuery does
2063
1826
  if ( fn[ expando ] ) {
2064
1827
  return fn( argument );
2065
1828
  }
@@ -2073,7 +1836,7 @@ Expr = Sizzle.selectors = {
2073
1836
  matched = fn( seed, argument ),
2074
1837
  i = matched.length;
2075
1838
  while ( i-- ) {
2076
- idx = indexOf( seed, matched[ i ] );
1839
+ idx = indexOf.call( seed, matched[ i ] );
2077
1840
  seed[ idx ] = !( matches[ idx ] = matched[ i ] );
2078
1841
  }
2079
1842
  } ) :
@@ -2089,14 +1852,14 @@ Expr = Sizzle.selectors = {
2089
1852
  pseudos: {
2090
1853
 
2091
1854
  // Potentially complex pseudos
2092
- "not": markFunction( function( selector ) {
1855
+ not: markFunction( function( selector ) {
2093
1856
 
2094
1857
  // Trim the selector passed to compile
2095
1858
  // to avoid treating leading and trailing
2096
1859
  // spaces as combinators
2097
1860
  var input = [],
2098
1861
  results = [],
2099
- matcher = compile( selector.replace( rtrim, "$1" ) );
1862
+ matcher = compile( selector.replace( rtrimCSS, "$1" ) );
2100
1863
 
2101
1864
  return matcher[ expando ] ?
2102
1865
  markFunction( function( seed, matches, _context, xml ) {
@@ -2115,22 +1878,23 @@ Expr = Sizzle.selectors = {
2115
1878
  input[ 0 ] = elem;
2116
1879
  matcher( input, null, xml, results );
2117
1880
 
2118
- // Don't keep the element (issue #299)
1881
+ // Don't keep the element
1882
+ // (see https://github.com/jquery/sizzle/issues/299)
2119
1883
  input[ 0 ] = null;
2120
1884
  return !results.pop();
2121
1885
  };
2122
1886
  } ),
2123
1887
 
2124
- "has": markFunction( function( selector ) {
1888
+ has: markFunction( function( selector ) {
2125
1889
  return function( elem ) {
2126
- return Sizzle( selector, elem ).length > 0;
1890
+ return find( selector, elem ).length > 0;
2127
1891
  };
2128
1892
  } ),
2129
1893
 
2130
- "contains": markFunction( function( text ) {
1894
+ contains: markFunction( function( text ) {
2131
1895
  text = text.replace( runescape, funescape );
2132
1896
  return function( elem ) {
2133
- return ( elem.textContent || getText( elem ) ).indexOf( text ) > -1;
1897
+ return ( elem.textContent || jQuery.text( elem ) ).indexOf( text ) > -1;
2134
1898
  };
2135
1899
  } ),
2136
1900
 
@@ -2140,12 +1904,12 @@ Expr = Sizzle.selectors = {
2140
1904
  // or beginning with the identifier C immediately followed by "-".
2141
1905
  // The matching of C against the element's language value is performed case-insensitively.
2142
1906
  // 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 ) {
1907
+ // https://www.w3.org/TR/selectors/#lang-pseudo
1908
+ lang: markFunction( function( lang ) {
2145
1909
 
2146
1910
  // lang value must be a valid identifier
2147
1911
  if ( !ridentifier.test( lang || "" ) ) {
2148
- Sizzle.error( "unsupported lang: " + lang );
1912
+ find.error( "unsupported lang: " + lang );
2149
1913
  }
2150
1914
  lang = lang.replace( runescape, funescape ).toLowerCase();
2151
1915
  return function( elem ) {
@@ -2164,38 +1928,39 @@ Expr = Sizzle.selectors = {
2164
1928
  } ),
2165
1929
 
2166
1930
  // Miscellaneous
2167
- "target": function( elem ) {
1931
+ target: function( elem ) {
2168
1932
  var hash = window.location && window.location.hash;
2169
1933
  return hash && hash.slice( 1 ) === elem.id;
2170
1934
  },
2171
1935
 
2172
- "root": function( elem ) {
2173
- return elem === docElem;
1936
+ root: function( elem ) {
1937
+ return elem === documentElement;
2174
1938
  },
2175
1939
 
2176
- "focus": function( elem ) {
2177
- return elem === document.activeElement &&
2178
- ( !document.hasFocus || document.hasFocus() ) &&
1940
+ focus: function( elem ) {
1941
+ return elem === safeActiveElement() &&
1942
+ document.hasFocus() &&
2179
1943
  !!( elem.type || elem.href || ~elem.tabIndex );
2180
1944
  },
2181
1945
 
2182
1946
  // Boolean properties
2183
- "enabled": createDisabledPseudo( false ),
2184
- "disabled": createDisabledPseudo( true ),
1947
+ enabled: createDisabledPseudo( false ),
1948
+ disabled: createDisabledPseudo( true ),
2185
1949
 
2186
- "checked": function( elem ) {
1950
+ checked: function( elem ) {
2187
1951
 
2188
1952
  // 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 );
1953
+ // https://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
1954
+ return ( nodeName( elem, "input" ) && !!elem.checked ) ||
1955
+ ( nodeName( elem, "option" ) && !!elem.selected );
2193
1956
  },
2194
1957
 
2195
- "selected": function( elem ) {
1958
+ selected: function( elem ) {
2196
1959
 
2197
- // Accessing this property makes selected-by-default
2198
- // options in Safari work properly
1960
+ // Support: IE <=11+
1961
+ // Accessing the selectedIndex property
1962
+ // forces the browser to treat the default option as
1963
+ // selected when in an optgroup.
2199
1964
  if ( elem.parentNode ) {
2200
1965
  // eslint-disable-next-line no-unused-expressions
2201
1966
  elem.parentNode.selectedIndex;
@@ -2205,9 +1970,9 @@ Expr = Sizzle.selectors = {
2205
1970
  },
2206
1971
 
2207
1972
  // Contents
2208
- "empty": function( elem ) {
1973
+ empty: function( elem ) {
2209
1974
 
2210
- // http://www.w3.org/TR/selectors/#empty-pseudo
1975
+ // https://www.w3.org/TR/selectors/#empty-pseudo
2211
1976
  // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5),
2212
1977
  // but not by others (comment: 8; processing instruction: 7; etc.)
2213
1978
  // nodeType < 6 works because attributes (2) do not appear as children
@@ -2219,49 +1984,49 @@ Expr = Sizzle.selectors = {
2219
1984
  return true;
2220
1985
  },
2221
1986
 
2222
- "parent": function( elem ) {
2223
- return !Expr.pseudos[ "empty" ]( elem );
1987
+ parent: function( elem ) {
1988
+ return !Expr.pseudos.empty( elem );
2224
1989
  },
2225
1990
 
2226
1991
  // Element/input types
2227
- "header": function( elem ) {
1992
+ header: function( elem ) {
2228
1993
  return rheader.test( elem.nodeName );
2229
1994
  },
2230
1995
 
2231
- "input": function( elem ) {
1996
+ input: function( elem ) {
2232
1997
  return rinputs.test( elem.nodeName );
2233
1998
  },
2234
1999
 
2235
- "button": function( elem ) {
2236
- var name = elem.nodeName.toLowerCase();
2237
- return name === "input" && elem.type === "button" || name === "button";
2000
+ button: function( elem ) {
2001
+ return nodeName( elem, "input" ) && elem.type === "button" ||
2002
+ nodeName( elem, "button" );
2238
2003
  },
2239
2004
 
2240
- "text": function( elem ) {
2005
+ text: function( elem ) {
2241
2006
  var attr;
2242
- return elem.nodeName.toLowerCase() === "input" &&
2243
- elem.type === "text" &&
2007
+ return nodeName( elem, "input" ) && elem.type === "text" &&
2244
2008
 
2245
- // Support: IE<8
2246
- // New HTML5 attribute values (e.g., "search") appear with elem.type === "text"
2009
+ // Support: IE <10 only
2010
+ // New HTML5 attribute values (e.g., "search") appear
2011
+ // with elem.type === "text"
2247
2012
  ( ( attr = elem.getAttribute( "type" ) ) == null ||
2248
2013
  attr.toLowerCase() === "text" );
2249
2014
  },
2250
2015
 
2251
2016
  // Position-in-collection
2252
- "first": createPositionalPseudo( function() {
2017
+ first: createPositionalPseudo( function() {
2253
2018
  return [ 0 ];
2254
2019
  } ),
2255
2020
 
2256
- "last": createPositionalPseudo( function( _matchIndexes, length ) {
2021
+ last: createPositionalPseudo( function( _matchIndexes, length ) {
2257
2022
  return [ length - 1 ];
2258
2023
  } ),
2259
2024
 
2260
- "eq": createPositionalPseudo( function( _matchIndexes, length, argument ) {
2025
+ eq: createPositionalPseudo( function( _matchIndexes, length, argument ) {
2261
2026
  return [ argument < 0 ? argument + length : argument ];
2262
2027
  } ),
2263
2028
 
2264
- "even": createPositionalPseudo( function( matchIndexes, length ) {
2029
+ even: createPositionalPseudo( function( matchIndexes, length ) {
2265
2030
  var i = 0;
2266
2031
  for ( ; i < length; i += 2 ) {
2267
2032
  matchIndexes.push( i );
@@ -2269,7 +2034,7 @@ Expr = Sizzle.selectors = {
2269
2034
  return matchIndexes;
2270
2035
  } ),
2271
2036
 
2272
- "odd": createPositionalPseudo( function( matchIndexes, length ) {
2037
+ odd: createPositionalPseudo( function( matchIndexes, length ) {
2273
2038
  var i = 1;
2274
2039
  for ( ; i < length; i += 2 ) {
2275
2040
  matchIndexes.push( i );
@@ -2277,19 +2042,24 @@ Expr = Sizzle.selectors = {
2277
2042
  return matchIndexes;
2278
2043
  } ),
2279
2044
 
2280
- "lt": createPositionalPseudo( function( matchIndexes, length, argument ) {
2281
- var i = argument < 0 ?
2282
- argument + length :
2283
- argument > length ?
2284
- length :
2285
- argument;
2045
+ lt: createPositionalPseudo( function( matchIndexes, length, argument ) {
2046
+ var i;
2047
+
2048
+ if ( argument < 0 ) {
2049
+ i = argument + length;
2050
+ } else if ( argument > length ) {
2051
+ i = length;
2052
+ } else {
2053
+ i = argument;
2054
+ }
2055
+
2286
2056
  for ( ; --i >= 0; ) {
2287
2057
  matchIndexes.push( i );
2288
2058
  }
2289
2059
  return matchIndexes;
2290
2060
  } ),
2291
2061
 
2292
- "gt": createPositionalPseudo( function( matchIndexes, length, argument ) {
2062
+ gt: createPositionalPseudo( function( matchIndexes, length, argument ) {
2293
2063
  var i = argument < 0 ? argument + length : argument;
2294
2064
  for ( ; ++i < length; ) {
2295
2065
  matchIndexes.push( i );
@@ -2299,7 +2069,7 @@ Expr = Sizzle.selectors = {
2299
2069
  }
2300
2070
  };
2301
2071
 
2302
- Expr.pseudos[ "nth" ] = Expr.pseudos[ "eq" ];
2072
+ Expr.pseudos.nth = Expr.pseudos.eq;
2303
2073
 
2304
2074
  // Add button/input type pseudos
2305
2075
  for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) {
@@ -2314,7 +2084,7 @@ function setFilters() {}
2314
2084
  setFilters.prototype = Expr.filters = Expr.pseudos;
2315
2085
  Expr.setFilters = new setFilters();
2316
2086
 
2317
- tokenize = Sizzle.tokenize = function( selector, parseOnly ) {
2087
+ function tokenize( selector, parseOnly ) {
2318
2088
  var matched, match, tokens, type,
2319
2089
  soFar, groups, preFilters,
2320
2090
  cached = tokenCache[ selector + " " ];
@@ -2342,13 +2112,13 @@ tokenize = Sizzle.tokenize = function( selector, parseOnly ) {
2342
2112
  matched = false;
2343
2113
 
2344
2114
  // Combinators
2345
- if ( ( match = rcombinators.exec( soFar ) ) ) {
2115
+ if ( ( match = rleadingCombinator.exec( soFar ) ) ) {
2346
2116
  matched = match.shift();
2347
2117
  tokens.push( {
2348
2118
  value: matched,
2349
2119
 
2350
2120
  // Cast descendant combinators to space
2351
- type: match[ 0 ].replace( rtrim, " " )
2121
+ type: match[ 0 ].replace( rtrimCSS, " " )
2352
2122
  } );
2353
2123
  soFar = soFar.slice( matched.length );
2354
2124
  }
@@ -2375,14 +2145,16 @@ tokenize = Sizzle.tokenize = function( selector, parseOnly ) {
2375
2145
  // Return the length of the invalid excess
2376
2146
  // if we're just parsing
2377
2147
  // Otherwise, throw an error or return tokens
2378
- return parseOnly ?
2379
- soFar.length :
2380
- soFar ?
2381
- Sizzle.error( selector ) :
2148
+ if ( parseOnly ) {
2149
+ return soFar.length;
2150
+ }
2382
2151
 
2383
- // Cache the tokens
2384
- tokenCache( selector, groups ).slice( 0 );
2385
- };
2152
+ return soFar ?
2153
+ find.error( selector ) :
2154
+
2155
+ // Cache the tokens
2156
+ tokenCache( selector, groups ).slice( 0 );
2157
+ }
2386
2158
 
2387
2159
  function toSelector( tokens ) {
2388
2160
  var i = 0,
@@ -2415,7 +2187,7 @@ function addCombinator( matcher, combinator, base ) {
2415
2187
 
2416
2188
  // Check against all ancestor/preceding elements
2417
2189
  function( elem, context, xml ) {
2418
- var oldCache, uniqueCache, outerCache,
2190
+ var oldCache, outerCache,
2419
2191
  newCache = [ dirruns, doneName ];
2420
2192
 
2421
2193
  // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching
@@ -2432,14 +2204,9 @@ function addCombinator( matcher, combinator, base ) {
2432
2204
  if ( elem.nodeType === 1 || checkNonElements ) {
2433
2205
  outerCache = elem[ expando ] || ( elem[ expando ] = {} );
2434
2206
 
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() ) {
2207
+ if ( skip && nodeName( elem, skip ) ) {
2441
2208
  elem = elem[ dir ] || elem;
2442
- } else if ( ( oldCache = uniqueCache[ key ] ) &&
2209
+ } else if ( ( oldCache = outerCache[ key ] ) &&
2443
2210
  oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) {
2444
2211
 
2445
2212
  // Assign to newCache so results back-propagate to previous elements
@@ -2447,7 +2214,7 @@ function addCombinator( matcher, combinator, base ) {
2447
2214
  } else {
2448
2215
 
2449
2216
  // Reuse newcache so results back-propagate to previous elements
2450
- uniqueCache[ key ] = newCache;
2217
+ outerCache[ key ] = newCache;
2451
2218
 
2452
2219
  // A match means we're done; a fail means we have to keep checking
2453
2220
  if ( ( newCache[ 2 ] = matcher( elem, context, xml ) ) ) {
@@ -2479,7 +2246,7 @@ function multipleContexts( selector, contexts, results ) {
2479
2246
  var i = 0,
2480
2247
  len = contexts.length;
2481
2248
  for ( ; i < len; i++ ) {
2482
- Sizzle( selector, contexts[ i ], results );
2249
+ find( selector, contexts[ i ], results );
2483
2250
  }
2484
2251
  return results;
2485
2252
  }
@@ -2513,38 +2280,37 @@ function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postS
2513
2280
  postFinder = setMatcher( postFinder, postSelector );
2514
2281
  }
2515
2282
  return markFunction( function( seed, results, context, xml ) {
2516
- var temp, i, elem,
2283
+ var temp, i, elem, matcherOut,
2517
2284
  preMap = [],
2518
2285
  postMap = [],
2519
2286
  preexisting = results.length,
2520
2287
 
2521
2288
  // Get initial elements from seed or context
2522
- elems = seed || multipleContexts(
2523
- selector || "*",
2524
- context.nodeType ? [ context ] : context,
2525
- []
2526
- ),
2289
+ elems = seed ||
2290
+ multipleContexts( selector || "*",
2291
+ context.nodeType ? [ context ] : context, [] ),
2527
2292
 
2528
2293
  // Prefilter to get matcher input, preserving a map for seed-results synchronization
2529
2294
  matcherIn = preFilter && ( seed || !selector ) ?
2530
2295
  condense( elems, preMap, preFilter, context, xml ) :
2531
- elems,
2296
+ elems;
2532
2297
 
2533
- matcherOut = matcher ?
2298
+ if ( matcher ) {
2534
2299
 
2535
- // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
2536
- postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
2300
+ // If we have a postFinder, or filtered seed, or non-seed postFilter
2301
+ // or preexisting results,
2302
+ matcherOut = postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
2537
2303
 
2538
- // ...intermediate processing is necessary
2539
- [] :
2304
+ // ...intermediate processing is necessary
2305
+ [] :
2540
2306
 
2541
- // ...otherwise use results directly
2542
- results :
2543
- matcherIn;
2307
+ // ...otherwise use results directly
2308
+ results;
2544
2309
 
2545
- // Find primary matches
2546
- if ( matcher ) {
2310
+ // Find primary matches
2547
2311
  matcher( matcherIn, matcherOut, context, xml );
2312
+ } else {
2313
+ matcherOut = matcherIn;
2548
2314
  }
2549
2315
 
2550
2316
  // Apply postFilter
@@ -2582,7 +2348,7 @@ function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postS
2582
2348
  i = matcherOut.length;
2583
2349
  while ( i-- ) {
2584
2350
  if ( ( elem = matcherOut[ i ] ) &&
2585
- ( temp = postFinder ? indexOf( seed, elem ) : preMap[ i ] ) > -1 ) {
2351
+ ( temp = postFinder ? indexOf.call( seed, elem ) : preMap[ i ] ) > -1 ) {
2586
2352
 
2587
2353
  seed[ temp ] = !( results[ temp ] = elem );
2588
2354
  }
@@ -2617,15 +2383,21 @@ function matcherFromTokens( tokens ) {
2617
2383
  return elem === checkContext;
2618
2384
  }, implicitRelative, true ),
2619
2385
  matchAnyContext = addCombinator( function( elem ) {
2620
- return indexOf( checkContext, elem ) > -1;
2386
+ return indexOf.call( checkContext, elem ) > -1;
2621
2387
  }, implicitRelative, true ),
2622
2388
  matchers = [ function( elem, context, xml ) {
2623
- var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || (
2389
+
2390
+ // Support: IE 11+, Edge 17 - 18+
2391
+ // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
2392
+ // two documents; shallow comparisons work.
2393
+ // eslint-disable-next-line eqeqeq
2394
+ var ret = ( !leadingRelative && ( xml || context != outermostContext ) ) || (
2624
2395
  ( checkContext = context ).nodeType ?
2625
2396
  matchContext( elem, context, xml ) :
2626
2397
  matchAnyContext( elem, context, xml ) );
2627
2398
 
2628
- // Avoid hanging onto element (issue #299)
2399
+ // Avoid hanging onto element
2400
+ // (see https://github.com/jquery/sizzle/issues/299)
2629
2401
  checkContext = null;
2630
2402
  return ret;
2631
2403
  } ];
@@ -2650,11 +2422,10 @@ function matcherFromTokens( tokens ) {
2650
2422
  i > 1 && elementMatcher( matchers ),
2651
2423
  i > 1 && toSelector(
2652
2424
 
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" ),
2425
+ // If the preceding token was a descendant combinator, insert an implicit any-element `*`
2426
+ tokens.slice( 0, i - 1 )
2427
+ .concat( { value: tokens[ i - 2 ].type === " " ? "*" : "" } )
2428
+ ).replace( rtrimCSS, "$1" ),
2658
2429
  matcher,
2659
2430
  i < j && matcherFromTokens( tokens.slice( i, j ) ),
2660
2431
  j < len && matcherFromTokens( ( tokens = tokens.slice( j ) ) ),
@@ -2680,7 +2451,7 @@ function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
2680
2451
  contextBackup = outermostContext,
2681
2452
 
2682
2453
  // We must always have either seed elements or outermost context
2683
- elems = seed || byElement && Expr.find[ "TAG" ]( "*", outermost ),
2454
+ elems = seed || byElement && Expr.find.TAG( "*", outermost ),
2684
2455
 
2685
2456
  // Use integer dirruns iff this is the outermost matcher
2686
2457
  dirrunsUnique = ( dirruns += contextBackup == null ? 1 : Math.random() || 0.1 ),
@@ -2696,8 +2467,9 @@ function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
2696
2467
  }
2697
2468
 
2698
2469
  // Add elements passing elementMatchers directly to results
2699
- // Support: IE<9, Safari
2700
- // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id
2470
+ // Support: iOS <=7 - 9 only
2471
+ // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching
2472
+ // elements by id. (see trac-14142)
2701
2473
  for ( ; i !== len && ( elem = elems[ i ] ) != null; i++ ) {
2702
2474
  if ( byElement && elem ) {
2703
2475
  j = 0;
@@ -2712,7 +2484,7 @@ function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
2712
2484
  }
2713
2485
  while ( ( matcher = elementMatchers[ j++ ] ) ) {
2714
2486
  if ( matcher( elem, context || document, xml ) ) {
2715
- results.push( elem );
2487
+ push.call( results, elem );
2716
2488
  break;
2717
2489
  }
2718
2490
  }
@@ -2775,7 +2547,7 @@ function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
2775
2547
  if ( outermost && !seed && setMatched.length > 0 &&
2776
2548
  ( matchedCount + setMatchers.length ) > 1 ) {
2777
2549
 
2778
- Sizzle.uniqueSort( results );
2550
+ jQuery.uniqueSort( results );
2779
2551
  }
2780
2552
  }
2781
2553
 
@@ -2793,7 +2565,7 @@ function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
2793
2565
  superMatcher;
2794
2566
  }
2795
2567
 
2796
- compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) {
2568
+ function compile( selector, match /* Internal Use Only */ ) {
2797
2569
  var i,
2798
2570
  setMatchers = [],
2799
2571
  elementMatchers = [],
@@ -2816,27 +2588,25 @@ compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) {
2816
2588
  }
2817
2589
 
2818
2590
  // Cache the compiled function
2819
- cached = compilerCache(
2820
- selector,
2821
- matcherFromGroupMatchers( elementMatchers, setMatchers )
2822
- );
2591
+ cached = compilerCache( selector,
2592
+ matcherFromGroupMatchers( elementMatchers, setMatchers ) );
2823
2593
 
2824
2594
  // Save selector and tokenization
2825
2595
  cached.selector = selector;
2826
2596
  }
2827
2597
  return cached;
2828
- };
2598
+ }
2829
2599
 
2830
2600
  /**
2831
- * A low-level selection function that works with Sizzle's compiled
2601
+ * A low-level selection function that works with jQuery's compiled
2832
2602
  * selector functions
2833
2603
  * @param {String|Function} selector A selector or a pre-compiled
2834
- * selector function built with Sizzle.compile
2604
+ * selector function built with jQuery selector compile
2835
2605
  * @param {Element} context
2836
2606
  * @param {Array} [results]
2837
2607
  * @param {Array} [seed] A set of elements to match against
2838
2608
  */
2839
- select = Sizzle.select = function( selector, context, results, seed ) {
2609
+ function select( selector, context, results, seed ) {
2840
2610
  var i, tokens, token, type, find,
2841
2611
  compiled = typeof selector === "function" && selector,
2842
2612
  match = !seed && tokenize( ( selector = compiled.selector || selector ) );
@@ -2850,10 +2620,12 @@ select = Sizzle.select = function( selector, context, results, seed ) {
2850
2620
  // Reduce context if the leading compound selector is an ID
2851
2621
  tokens = match[ 0 ] = match[ 0 ].slice( 0 );
2852
2622
  if ( tokens.length > 2 && ( token = tokens[ 0 ] ).type === "ID" &&
2853
- context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[ 1 ].type ] ) {
2623
+ context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[ 1 ].type ] ) {
2854
2624
 
2855
- context = ( Expr.find[ "ID" ]( token.matches[ 0 ]
2856
- .replace( runescape, funescape ), context ) || [] )[ 0 ];
2625
+ context = ( Expr.find.ID(
2626
+ token.matches[ 0 ].replace( runescape, funescape ),
2627
+ context
2628
+ ) || [] )[ 0 ];
2857
2629
  if ( !context ) {
2858
2630
  return results;
2859
2631
 
@@ -2866,7 +2638,7 @@ select = Sizzle.select = function( selector, context, results, seed ) {
2866
2638
  }
2867
2639
 
2868
2640
  // Fetch a seed set for right-to-left matching
2869
- i = matchExpr[ "needsContext" ].test( selector ) ? 0 : tokens.length;
2641
+ i = matchExpr.needsContext.test( selector ) ? 0 : tokens.length;
2870
2642
  while ( i-- ) {
2871
2643
  token = tokens[ i ];
2872
2644
 
@@ -2879,8 +2651,8 @@ select = Sizzle.select = function( selector, context, results, seed ) {
2879
2651
  // Search, expanding context for leading sibling combinators
2880
2652
  if ( ( seed = find(
2881
2653
  token.matches[ 0 ].replace( runescape, funescape ),
2882
- rsibling.test( tokens[ 0 ].type ) && testContext( context.parentNode ) ||
2883
- context
2654
+ rsibling.test( tokens[ 0 ].type ) &&
2655
+ testContext( context.parentNode ) || context
2884
2656
  ) ) ) {
2885
2657
 
2886
2658
  // If seed is empty or no tokens remain, we can return early
@@ -2907,21 +2679,18 @@ select = Sizzle.select = function( selector, context, results, seed ) {
2907
2679
  !context || rsibling.test( selector ) && testContext( context.parentNode ) || context
2908
2680
  );
2909
2681
  return results;
2910
- };
2682
+ }
2911
2683
 
2912
2684
  // One-time assignments
2913
2685
 
2686
+ // Support: Android <=4.0 - 4.1+
2914
2687
  // Sort stability
2915
2688
  support.sortStable = expando.split( "" ).sort( sortOrder ).join( "" ) === expando;
2916
2689
 
2917
- // Support: Chrome 14-35+
2918
- // Always assume duplicates if they aren't passed to the comparison function
2919
- support.detectDuplicates = !!hasDuplicate;
2920
-
2921
2690
  // Initialize against the default document
2922
2691
  setDocument();
2923
2692
 
2924
- // Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27)
2693
+ // Support: Android <=4.0 - 4.1+
2925
2694
  // Detached nodes confoundingly follow *each other*
2926
2695
  support.sortDetached = assert( function( el ) {
2927
2696
 
@@ -2929,68 +2698,29 @@ support.sortDetached = assert( function( el ) {
2929
2698
  return el.compareDocumentPosition( document.createElement( "fieldset" ) ) & 1;
2930
2699
  } );
2931
2700
 
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;
2701
+ jQuery.find = find;
2984
2702
 
2985
2703
  // Deprecated
2986
2704
  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;
2705
+ jQuery.unique = jQuery.uniqueSort;
2706
+
2707
+ // These have always been private, but they used to be documented as part of
2708
+ // Sizzle so let's maintain them for now for backwards compatibility purposes.
2709
+ find.compile = compile;
2710
+ find.select = select;
2711
+ find.setDocument = setDocument;
2712
+ find.tokenize = tokenize;
2713
+
2714
+ find.escape = jQuery.escapeSelector;
2715
+ find.getText = jQuery.text;
2716
+ find.isXML = jQuery.isXMLDoc;
2717
+ find.selectors = jQuery.expr;
2718
+ find.support = jQuery.support;
2719
+ find.uniqueSort = jQuery.uniqueSort;
2992
2720
 
2721
+ /* eslint-enable */
2993
2722
 
2723
+ } )();
2994
2724
 
2995
2725
 
2996
2726
  var dir = function( elem, dir, until ) {
@@ -3024,13 +2754,6 @@ var siblings = function( n, elem ) {
3024
2754
 
3025
2755
  var rneedsContext = jQuery.expr.match.needsContext;
3026
2756
 
3027
-
3028
-
3029
- function nodeName( elem, name ) {
3030
-
3031
- return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
3032
-
3033
- }
3034
2757
  var rsingleTag = ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i );
3035
2758
 
3036
2759
 
@@ -3129,8 +2852,8 @@ jQuery.fn.extend( {
3129
2852
  var rootjQuery,
3130
2853
 
3131
2854
  // A simple way to check for HTML strings
3132
- // Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
3133
- // Strict HTML recognition (#11290: must start with <)
2855
+ // Prioritize #id over <tag> to avoid XSS via location.hash (trac-9521)
2856
+ // Strict HTML recognition (trac-11290: must start with <)
3134
2857
  // Shortcut simple #id case for speed
3135
2858
  rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,
3136
2859
 
@@ -3281,7 +3004,7 @@ jQuery.fn.extend( {
3281
3004
  if ( cur.nodeType < 11 && ( targets ?
3282
3005
  targets.index( cur ) > -1 :
3283
3006
 
3284
- // Don't pass non-elements to Sizzle
3007
+ // Don't pass non-elements to jQuery#find
3285
3008
  cur.nodeType === 1 &&
3286
3009
  jQuery.find.matchesSelector( cur, selectors ) ) ) {
3287
3010
 
@@ -3836,7 +3559,7 @@ jQuery.extend( {
3836
3559
 
3837
3560
  if ( jQuery.Deferred.exceptionHook ) {
3838
3561
  jQuery.Deferred.exceptionHook( e,
3839
- process.stackTrace );
3562
+ process.error );
3840
3563
  }
3841
3564
 
3842
3565
  // Support: Promises/A+ section 2.3.3.3.4.1
@@ -3864,10 +3587,17 @@ jQuery.extend( {
3864
3587
  process();
3865
3588
  } else {
3866
3589
 
3867
- // Call an optional hook to record the stack, in case of exception
3590
+ // Call an optional hook to record the error, in case of exception
3868
3591
  // since it's otherwise lost when execution goes async
3869
- if ( jQuery.Deferred.getStackHook ) {
3870
- process.stackTrace = jQuery.Deferred.getStackHook();
3592
+ if ( jQuery.Deferred.getErrorHook ) {
3593
+ process.error = jQuery.Deferred.getErrorHook();
3594
+
3595
+ // The deprecated alias of the above. While the name suggests
3596
+ // returning the stack, not an error instance, jQuery just passes
3597
+ // it directly to `console.warn` so both will work; an instance
3598
+ // just better cooperates with source maps.
3599
+ } else if ( jQuery.Deferred.getStackHook ) {
3600
+ process.error = jQuery.Deferred.getStackHook();
3871
3601
  }
3872
3602
  window.setTimeout( process );
3873
3603
  }
@@ -4042,12 +3772,16 @@ jQuery.extend( {
4042
3772
  // warn about them ASAP rather than swallowing them by default.
4043
3773
  var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;
4044
3774
 
4045
- jQuery.Deferred.exceptionHook = function( error, stack ) {
3775
+ // If `jQuery.Deferred.getErrorHook` is defined, `asyncError` is an error
3776
+ // captured before the async barrier to get the original error cause
3777
+ // which may otherwise be hidden.
3778
+ jQuery.Deferred.exceptionHook = function( error, asyncError ) {
4046
3779
 
4047
3780
  // Support: IE 8 - 9 only
4048
3781
  // Console exists when dev tools are open, which can happen at any time
4049
3782
  if ( window.console && window.console.warn && error && rerrorNames.test( error.name ) ) {
4050
- window.console.warn( "jQuery.Deferred exception: " + error.message, error.stack, stack );
3783
+ window.console.warn( "jQuery.Deferred exception: " + error.message,
3784
+ error.stack, asyncError );
4051
3785
  }
4052
3786
  };
4053
3787
 
@@ -4087,7 +3821,7 @@ jQuery.extend( {
4087
3821
  isReady: false,
4088
3822
 
4089
3823
  // A counter to track how many items to wait for before
4090
- // the ready event fires. See #6781
3824
+ // the ready event fires. See trac-6781
4091
3825
  readyWait: 1,
4092
3826
 
4093
3827
  // Handle when the DOM is ready
@@ -4215,7 +3949,7 @@ function fcamelCase( _all, letter ) {
4215
3949
 
4216
3950
  // Convert dashed to camelCase; used by the css and data modules
4217
3951
  // Support: IE <=9 - 11, Edge 12 - 15
4218
- // Microsoft forgot to hump their vendor prefix (#9572)
3952
+ // Microsoft forgot to hump their vendor prefix (trac-9572)
4219
3953
  function camelCase( string ) {
4220
3954
  return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
4221
3955
  }
@@ -4251,7 +3985,7 @@ Data.prototype = {
4251
3985
  value = {};
4252
3986
 
4253
3987
  // We can accept data for non-element nodes in modern browsers,
4254
- // but we should not, see #8335.
3988
+ // but we should not, see trac-8335.
4255
3989
  // Always return an empty object.
4256
3990
  if ( acceptData( owner ) ) {
4257
3991
 
@@ -4490,7 +4224,7 @@ jQuery.fn.extend( {
4490
4224
  while ( i-- ) {
4491
4225
 
4492
4226
  // Support: IE 11 only
4493
- // The attrs elements can be null (#14894)
4227
+ // The attrs elements can be null (trac-14894)
4494
4228
  if ( attrs[ i ] ) {
4495
4229
  name = attrs[ i ].name;
4496
4230
  if ( name.indexOf( "data-" ) === 0 ) {
@@ -4913,9 +4647,9 @@ var rscriptType = ( /^$|^module$|\/(?:java|ecma)script/i );
4913
4647
  input = document.createElement( "input" );
4914
4648
 
4915
4649
  // Support: Android 4.0 - 4.3 only
4916
- // Check state lost if the name is set (#11217)
4650
+ // Check state lost if the name is set (trac-11217)
4917
4651
  // Support: Windows Web Apps (WWA)
4918
- // `name` and `type` must use .setAttribute for WWA (#14901)
4652
+ // `name` and `type` must use .setAttribute for WWA (trac-14901)
4919
4653
  input.setAttribute( "type", "radio" );
4920
4654
  input.setAttribute( "checked", "checked" );
4921
4655
  input.setAttribute( "name", "t" );
@@ -4939,7 +4673,7 @@ var rscriptType = ( /^$|^module$|\/(?:java|ecma)script/i );
4939
4673
  } )();
4940
4674
 
4941
4675
 
4942
- // We have to close these tags to support XHTML (#13200)
4676
+ // We have to close these tags to support XHTML (trac-13200)
4943
4677
  var wrapMap = {
4944
4678
 
4945
4679
  // XHTML parsers do not magically insert elements in the
@@ -4965,7 +4699,7 @@ if ( !support.option ) {
4965
4699
  function getAll( context, tag ) {
4966
4700
 
4967
4701
  // Support: IE <=9 - 11 only
4968
- // Use typeof to avoid zero-argument method invocation on host objects (#15151)
4702
+ // Use typeof to avoid zero-argument method invocation on host objects (trac-15151)
4969
4703
  var ret;
4970
4704
 
4971
4705
  if ( typeof context.getElementsByTagName !== "undefined" ) {
@@ -5048,7 +4782,7 @@ function buildFragment( elems, context, scripts, selection, ignored ) {
5048
4782
  // Remember the top-level container
5049
4783
  tmp = fragment.firstChild;
5050
4784
 
5051
- // Ensure the created nodes are orphaned (#12392)
4785
+ // Ensure the created nodes are orphaned (trac-12392)
5052
4786
  tmp.textContent = "";
5053
4787
  }
5054
4788
  }
@@ -5103,25 +4837,6 @@ function returnFalse() {
5103
4837
  return false;
5104
4838
  }
5105
4839
 
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
4840
  function on( elem, types, selector, data, fn, one ) {
5126
4841
  var origFn, type;
5127
4842
 
@@ -5469,15 +5184,15 @@ jQuery.event = {
5469
5184
 
5470
5185
  for ( ; cur !== this; cur = cur.parentNode || this ) {
5471
5186
 
5472
- // Don't check non-elements (#13208)
5473
- // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)
5187
+ // Don't check non-elements (trac-13208)
5188
+ // Don't process clicks on disabled elements (trac-6911, trac-8165, trac-11382, trac-11764)
5474
5189
  if ( cur.nodeType === 1 && !( event.type === "click" && cur.disabled === true ) ) {
5475
5190
  matchedHandlers = [];
5476
5191
  matchedSelectors = {};
5477
5192
  for ( i = 0; i < delegateCount; i++ ) {
5478
5193
  handleObj = handlers[ i ];
5479
5194
 
5480
- // Don't conflict with Object.prototype properties (#13203)
5195
+ // Don't conflict with Object.prototype properties (trac-13203)
5481
5196
  sel = handleObj.selector + " ";
5482
5197
 
5483
5198
  if ( matchedSelectors[ sel ] === undefined ) {
@@ -5559,7 +5274,7 @@ jQuery.event = {
5559
5274
  el.click && nodeName( el, "input" ) ) {
5560
5275
 
5561
5276
  // dataPriv.set( el, "click", ... )
5562
- leverageNative( el, "click", returnTrue );
5277
+ leverageNative( el, "click", true );
5563
5278
  }
5564
5279
 
5565
5280
  // Return false to allow normal processing in the caller
@@ -5610,10 +5325,10 @@ jQuery.event = {
5610
5325
  // synthetic events by interrupting progress until reinvoked in response to
5611
5326
  // *native* events that it fires directly, ensuring that state changes have
5612
5327
  // already occurred before other listeners are invoked.
5613
- function leverageNative( el, type, expectSync ) {
5328
+ function leverageNative( el, type, isSetup ) {
5614
5329
 
5615
- // Missing expectSync indicates a trigger call, which must force setup through jQuery.event.add
5616
- if ( !expectSync ) {
5330
+ // Missing `isSetup` indicates a trigger call, which must force setup through jQuery.event.add
5331
+ if ( !isSetup ) {
5617
5332
  if ( dataPriv.get( el, type ) === undefined ) {
5618
5333
  jQuery.event.add( el, type, returnTrue );
5619
5334
  }
@@ -5625,15 +5340,13 @@ function leverageNative( el, type, expectSync ) {
5625
5340
  jQuery.event.add( el, type, {
5626
5341
  namespace: false,
5627
5342
  handler: function( event ) {
5628
- var notAsync, result,
5343
+ var result,
5629
5344
  saved = dataPriv.get( this, type );
5630
5345
 
5631
5346
  if ( ( event.isTrigger & 1 ) && this[ type ] ) {
5632
5347
 
5633
5348
  // 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 ) {
5349
+ if ( !saved ) {
5637
5350
 
5638
5351
  // Store arguments for use when handling the inner native event
5639
5352
  // There will always be at least one argument (an event object), so this array
@@ -5642,33 +5355,22 @@ function leverageNative( el, type, expectSync ) {
5642
5355
  dataPriv.set( this, type, saved );
5643
5356
 
5644
5357
  // 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
5358
  this[ type ]();
5649
5359
  result = dataPriv.get( this, type );
5650
- if ( saved !== result || notAsync ) {
5651
- dataPriv.set( this, type, false );
5652
- } else {
5653
- result = {};
5654
- }
5360
+ dataPriv.set( this, type, false );
5361
+
5655
5362
  if ( saved !== result ) {
5656
5363
 
5657
5364
  // Cancel the outer synthetic event
5658
5365
  event.stopImmediatePropagation();
5659
5366
  event.preventDefault();
5660
5367
 
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;
5368
+ return result;
5667
5369
  }
5668
5370
 
5669
5371
  // 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.
5372
+ // (focus or blur), assume that the surrogate already propagated from triggering
5373
+ // the native event and prevent that from happening again here.
5672
5374
  // This technically gets the ordering wrong w.r.t. to `.trigger()` (in which the
5673
5375
  // bubbling surrogate propagates *after* the non-bubbling base), but that seems
5674
5376
  // less bad than duplication.
@@ -5678,22 +5380,25 @@ function leverageNative( el, type, expectSync ) {
5678
5380
 
5679
5381
  // If this is a native event triggered above, everything is now in order
5680
5382
  // Fire an inner synthetic event with the original arguments
5681
- } else if ( saved.length ) {
5383
+ } else if ( saved ) {
5682
5384
 
5683
5385
  // ...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();
5386
+ dataPriv.set( this, type, jQuery.event.trigger(
5387
+ saved[ 0 ],
5388
+ saved.slice( 1 ),
5389
+ this
5390
+ ) );
5391
+
5392
+ // Abort handling of the native event by all jQuery handlers while allowing
5393
+ // native handlers on the same element to run. On target, this is achieved
5394
+ // by stopping immediate propagation just on the jQuery event. However,
5395
+ // the native event is re-wrapped by a jQuery one on each level of the
5396
+ // propagation so the only way to stop it for jQuery is to stop it for
5397
+ // everyone via native `stopPropagation()`. This is not a problem for
5398
+ // focus/blur which don't bubble, but it does also stop click on checkboxes
5399
+ // and radios. We accept this limitation.
5400
+ event.stopPropagation();
5401
+ event.isImmediatePropagationStopped = returnTrue;
5697
5402
  }
5698
5403
  }
5699
5404
  } );
@@ -5731,7 +5436,7 @@ jQuery.Event = function( src, props ) {
5731
5436
 
5732
5437
  // Create target properties
5733
5438
  // Support: Safari <=6 - 7 only
5734
- // Target should not be a text node (#504, #13143)
5439
+ // Target should not be a text node (trac-504, trac-13143)
5735
5440
  this.target = ( src.target && src.target.nodeType === 3 ) ?
5736
5441
  src.target.parentNode :
5737
5442
  src.target;
@@ -5832,18 +5537,73 @@ jQuery.each( {
5832
5537
  }, jQuery.event.addProp );
5833
5538
 
5834
5539
  jQuery.each( { focus: "focusin", blur: "focusout" }, function( type, delegateType ) {
5540
+
5541
+ function focusMappedHandler( nativeEvent ) {
5542
+ if ( document.documentMode ) {
5543
+
5544
+ // Support: IE 11+
5545
+ // Attach a single focusin/focusout handler on the document while someone wants
5546
+ // focus/blur. This is because the former are synchronous in IE while the latter
5547
+ // are async. In other browsers, all those handlers are invoked synchronously.
5548
+
5549
+ // `handle` from private data would already wrap the event, but we need
5550
+ // to change the `type` here.
5551
+ var handle = dataPriv.get( this, "handle" ),
5552
+ event = jQuery.event.fix( nativeEvent );
5553
+ event.type = nativeEvent.type === "focusin" ? "focus" : "blur";
5554
+ event.isSimulated = true;
5555
+
5556
+ // First, handle focusin/focusout
5557
+ handle( nativeEvent );
5558
+
5559
+ // ...then, handle focus/blur
5560
+ //
5561
+ // focus/blur don't bubble while focusin/focusout do; simulate the former by only
5562
+ // invoking the handler at the lower level.
5563
+ if ( event.target === event.currentTarget ) {
5564
+
5565
+ // The setup part calls `leverageNative`, which, in turn, calls
5566
+ // `jQuery.event.add`, so event handle will already have been set
5567
+ // by this point.
5568
+ handle( event );
5569
+ }
5570
+ } else {
5571
+
5572
+ // For non-IE browsers, attach a single capturing handler on the document
5573
+ // while someone wants focusin/focusout.
5574
+ jQuery.event.simulate( delegateType, nativeEvent.target,
5575
+ jQuery.event.fix( nativeEvent ) );
5576
+ }
5577
+ }
5578
+
5835
5579
  jQuery.event.special[ type ] = {
5836
5580
 
5837
5581
  // Utilize native event if possible so blur/focus sequence is correct
5838
5582
  setup: function() {
5839
5583
 
5584
+ var attaches;
5585
+
5840
5586
  // Claim the first handler
5841
5587
  // dataPriv.set( this, "focus", ... )
5842
5588
  // dataPriv.set( this, "blur", ... )
5843
- leverageNative( this, type, expectSync );
5589
+ leverageNative( this, type, true );
5844
5590
 
5845
- // Return false to allow normal processing in the caller
5846
- return false;
5591
+ if ( document.documentMode ) {
5592
+
5593
+ // Support: IE 9 - 11+
5594
+ // We use the same native handler for focusin & focus (and focusout & blur)
5595
+ // so we need to coordinate setup & teardown parts between those events.
5596
+ // Use `delegateType` as the key as `type` is already used by `leverageNative`.
5597
+ attaches = dataPriv.get( this, delegateType );
5598
+ if ( !attaches ) {
5599
+ this.addEventListener( delegateType, focusMappedHandler );
5600
+ }
5601
+ dataPriv.set( this, delegateType, ( attaches || 0 ) + 1 );
5602
+ } else {
5603
+
5604
+ // Return false to allow normal processing in the caller
5605
+ return false;
5606
+ }
5847
5607
  },
5848
5608
  trigger: function() {
5849
5609
 
@@ -5854,14 +5614,84 @@ jQuery.each( { focus: "focusin", blur: "focusout" }, function( type, delegateTyp
5854
5614
  return true;
5855
5615
  },
5856
5616
 
5857
- // Suppress native focus or blur as it's already being fired
5858
- // in leverageNative.
5859
- _default: function() {
5860
- return true;
5617
+ teardown: function() {
5618
+ var attaches;
5619
+
5620
+ if ( document.documentMode ) {
5621
+ attaches = dataPriv.get( this, delegateType ) - 1;
5622
+ if ( !attaches ) {
5623
+ this.removeEventListener( delegateType, focusMappedHandler );
5624
+ dataPriv.remove( this, delegateType );
5625
+ } else {
5626
+ dataPriv.set( this, delegateType, attaches );
5627
+ }
5628
+ } else {
5629
+
5630
+ // Return false to indicate standard teardown should be applied
5631
+ return false;
5632
+ }
5633
+ },
5634
+
5635
+ // Suppress native focus or blur if we're currently inside
5636
+ // a leveraged native-event stack
5637
+ _default: function( event ) {
5638
+ return dataPriv.get( event.target, type );
5861
5639
  },
5862
5640
 
5863
5641
  delegateType: delegateType
5864
5642
  };
5643
+
5644
+ // Support: Firefox <=44
5645
+ // Firefox doesn't have focus(in | out) events
5646
+ // Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787
5647
+ //
5648
+ // Support: Chrome <=48 - 49, Safari <=9.0 - 9.1
5649
+ // focus(in | out) events fire after focus & blur events,
5650
+ // which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order
5651
+ // Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857
5652
+ //
5653
+ // Support: IE 9 - 11+
5654
+ // To preserve relative focusin/focus & focusout/blur event order guaranteed on the 3.x branch,
5655
+ // attach a single handler for both events in IE.
5656
+ jQuery.event.special[ delegateType ] = {
5657
+ setup: function() {
5658
+
5659
+ // Handle: regular nodes (via `this.ownerDocument`), window
5660
+ // (via `this.document`) & document (via `this`).
5661
+ var doc = this.ownerDocument || this.document || this,
5662
+ dataHolder = document.documentMode ? this : doc,
5663
+ attaches = dataPriv.get( dataHolder, delegateType );
5664
+
5665
+ // Support: IE 9 - 11+
5666
+ // We use the same native handler for focusin & focus (and focusout & blur)
5667
+ // so we need to coordinate setup & teardown parts between those events.
5668
+ // Use `delegateType` as the key as `type` is already used by `leverageNative`.
5669
+ if ( !attaches ) {
5670
+ if ( document.documentMode ) {
5671
+ this.addEventListener( delegateType, focusMappedHandler );
5672
+ } else {
5673
+ doc.addEventListener( type, focusMappedHandler, true );
5674
+ }
5675
+ }
5676
+ dataPriv.set( dataHolder, delegateType, ( attaches || 0 ) + 1 );
5677
+ },
5678
+ teardown: function() {
5679
+ var doc = this.ownerDocument || this.document || this,
5680
+ dataHolder = document.documentMode ? this : doc,
5681
+ attaches = dataPriv.get( dataHolder, delegateType ) - 1;
5682
+
5683
+ if ( !attaches ) {
5684
+ if ( document.documentMode ) {
5685
+ this.removeEventListener( delegateType, focusMappedHandler );
5686
+ } else {
5687
+ doc.removeEventListener( type, focusMappedHandler, true );
5688
+ }
5689
+ dataPriv.remove( dataHolder, delegateType );
5690
+ } else {
5691
+ dataPriv.set( dataHolder, delegateType, attaches );
5692
+ }
5693
+ }
5694
+ };
5865
5695
  } );
5866
5696
 
5867
5697
  // Create mouseenter/leave events using mouseover/out and event-time checks
@@ -5956,7 +5786,8 @@ var
5956
5786
 
5957
5787
  // checked="checked" or checked
5958
5788
  rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
5959
- rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;
5789
+
5790
+ rcleanScript = /^\s*<!\[CDATA\[|\]\]>\s*$/g;
5960
5791
 
5961
5792
  // Prefer a tbody over its parent table for containing new rows
5962
5793
  function manipulationTarget( elem, content ) {
@@ -6070,7 +5901,7 @@ function domManip( collection, args, callback, ignored ) {
6070
5901
 
6071
5902
  // Use the original fragment for the last item
6072
5903
  // instead of the first because it can end up
6073
- // being emptied incorrectly in certain situations (#8070).
5904
+ // being emptied incorrectly in certain situations (trac-8070).
6074
5905
  for ( ; i < l; i++ ) {
6075
5906
  node = fragment;
6076
5907
 
@@ -6092,7 +5923,7 @@ function domManip( collection, args, callback, ignored ) {
6092
5923
  if ( hasScripts ) {
6093
5924
  doc = scripts[ scripts.length - 1 ].ownerDocument;
6094
5925
 
6095
- // Reenable scripts
5926
+ // Re-enable scripts
6096
5927
  jQuery.map( scripts, restoreScript );
6097
5928
 
6098
5929
  // Evaluate executable scripts on first document insertion
@@ -6111,6 +5942,12 @@ function domManip( collection, args, callback, ignored ) {
6111
5942
  }, doc );
6112
5943
  }
6113
5944
  } else {
5945
+
5946
+ // Unwrap a CDATA section containing script contents. This shouldn't be
5947
+ // needed as in XML documents they're already not visible when
5948
+ // inspecting element contents and in HTML documents they have no
5949
+ // meaning but we're preserving that logic for backwards compatibility.
5950
+ // This will be removed completely in 4.0. See gh-4904.
6114
5951
  DOMEval( node.textContent.replace( rcleanScript, "" ), node, doc );
6115
5952
  }
6116
5953
  }
@@ -6157,7 +5994,8 @@ jQuery.extend( {
6157
5994
  if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) &&
6158
5995
  !jQuery.isXMLDoc( elem ) ) {
6159
5996
 
6160
- // We eschew Sizzle here for performance reasons: https://jsperf.com/getall-vs-sizzle/2
5997
+ // We eschew jQuery#find here for performance reasons:
5998
+ // https://jsperf.com/getall-vs-sizzle/2
6161
5999
  destElements = getAll( clone );
6162
6000
  srcElements = getAll( elem );
6163
6001
 
@@ -6393,9 +6231,12 @@ jQuery.each( {
6393
6231
  } );
6394
6232
  var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" );
6395
6233
 
6234
+ var rcustomProp = /^--/;
6235
+
6236
+
6396
6237
  var getStyles = function( elem ) {
6397
6238
 
6398
- // Support: IE <=11 only, Firefox <=30 (#15098, #14150)
6239
+ // Support: IE <=11 only, Firefox <=30 (trac-15098, trac-14150)
6399
6240
  // IE throws on elements created in popups
6400
6241
  // FF meanwhile throws on frame elements through "defaultView.getComputedStyle"
6401
6242
  var view = elem.ownerDocument.defaultView;
@@ -6495,7 +6336,7 @@ var rboxStyle = new RegExp( cssExpand.join( "|" ), "i" );
6495
6336
  }
6496
6337
 
6497
6338
  // Support: IE <=9 - 11 only
6498
- // Style of cloned element affects source element cloned (#8908)
6339
+ // Style of cloned element affects source element cloned (trac-8908)
6499
6340
  div.style.backgroundClip = "content-box";
6500
6341
  div.cloneNode( true ).style.backgroundClip = "";
6501
6342
  support.clearCloneStyle = div.style.backgroundClip === "content-box";
@@ -6539,7 +6380,7 @@ var rboxStyle = new RegExp( cssExpand.join( "|" ), "i" );
6539
6380
  trChild = document.createElement( "div" );
6540
6381
 
6541
6382
  table.style.cssText = "position:absolute;left:-11111px;border-collapse:separate";
6542
- tr.style.cssText = "border:1px solid";
6383
+ tr.style.cssText = "box-sizing:content-box;border:1px solid";
6543
6384
 
6544
6385
  // Support: Chrome 86+
6545
6386
  // Height set through cssText does not get applied.
@@ -6551,7 +6392,7 @@ var rboxStyle = new RegExp( cssExpand.join( "|" ), "i" );
6551
6392
  // In our bodyBackground.html iframe,
6552
6393
  // display for all div elements is set to "inline",
6553
6394
  // which causes a problem only in Android 8 Chrome 86.
6554
- // Ensuring the div is display: block
6395
+ // Ensuring the div is `display: block`
6555
6396
  // gets around this issue.
6556
6397
  trChild.style.display = "block";
6557
6398
 
@@ -6575,6 +6416,7 @@ var rboxStyle = new RegExp( cssExpand.join( "|" ), "i" );
6575
6416
 
6576
6417
  function curCSS( elem, name, computed ) {
6577
6418
  var width, minWidth, maxWidth, ret,
6419
+ isCustomProp = rcustomProp.test( name ),
6578
6420
 
6579
6421
  // Support: Firefox 51+
6580
6422
  // Retrieving style before computed somehow
@@ -6585,11 +6427,42 @@ function curCSS( elem, name, computed ) {
6585
6427
  computed = computed || getStyles( elem );
6586
6428
 
6587
6429
  // getPropertyValue is needed for:
6588
- // .css('filter') (IE 9 only, #12537)
6589
- // .css('--customProperty) (#3144)
6430
+ // .css('filter') (IE 9 only, trac-12537)
6431
+ // .css('--customProperty) (gh-3144)
6590
6432
  if ( computed ) {
6433
+
6434
+ // Support: IE <=9 - 11+
6435
+ // IE only supports `"float"` in `getPropertyValue`; in computed styles
6436
+ // it's only available as `"cssFloat"`. We no longer modify properties
6437
+ // sent to `.css()` apart from camelCasing, so we need to check both.
6438
+ // Normally, this would create difference in behavior: if
6439
+ // `getPropertyValue` returns an empty string, the value returned
6440
+ // by `.css()` would be `undefined`. This is usually the case for
6441
+ // disconnected elements. However, in IE even disconnected elements
6442
+ // with no styles return `"none"` for `getPropertyValue( "float" )`
6591
6443
  ret = computed.getPropertyValue( name ) || computed[ name ];
6592
6444
 
6445
+ if ( isCustomProp && ret ) {
6446
+
6447
+ // Support: Firefox 105+, Chrome <=105+
6448
+ // Spec requires trimming whitespace for custom properties (gh-4926).
6449
+ // Firefox only trims leading whitespace. Chrome just collapses
6450
+ // both leading & trailing whitespace to a single space.
6451
+ //
6452
+ // Fall back to `undefined` if empty string returned.
6453
+ // This collapses a missing definition with property defined
6454
+ // and set to an empty string but there's no standard API
6455
+ // allowing us to differentiate them without a performance penalty
6456
+ // and returning `undefined` aligns with older jQuery.
6457
+ //
6458
+ // rtrimCSS treats U+000D CARRIAGE RETURN and U+000C FORM FEED
6459
+ // as whitespace while CSS does not, but this is not a problem
6460
+ // because CSS preprocessing replaces them with U+000A LINE FEED
6461
+ // (which *is* CSS whitespace)
6462
+ // https://www.w3.org/TR/css-syntax-3/#input-preprocessing
6463
+ ret = ret.replace( rtrimCSS, "$1" ) || undefined;
6464
+ }
6465
+
6593
6466
  if ( ret === "" && !isAttached( elem ) ) {
6594
6467
  ret = jQuery.style( elem, name );
6595
6468
  }
@@ -6685,7 +6558,6 @@ var
6685
6558
  // except "table", "table-cell", or "table-caption"
6686
6559
  // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
6687
6560
  rdisplayswap = /^(none|table(?!-c[ea]).+)/,
6688
- rcustomProp = /^--/,
6689
6561
  cssShow = { position: "absolute", visibility: "hidden", display: "block" },
6690
6562
  cssNormalTransform = {
6691
6563
  letterSpacing: "0",
@@ -6707,7 +6579,8 @@ function setPositiveNumber( _elem, value, subtract ) {
6707
6579
  function boxModelAdjustment( elem, dimension, box, isBorderBox, styles, computedVal ) {
6708
6580
  var i = dimension === "width" ? 1 : 0,
6709
6581
  extra = 0,
6710
- delta = 0;
6582
+ delta = 0,
6583
+ marginDelta = 0;
6711
6584
 
6712
6585
  // Adjustment may not be necessary
6713
6586
  if ( box === ( isBorderBox ? "border" : "content" ) ) {
@@ -6717,8 +6590,10 @@ function boxModelAdjustment( elem, dimension, box, isBorderBox, styles, computed
6717
6590
  for ( ; i < 4; i += 2 ) {
6718
6591
 
6719
6592
  // Both box models exclude margin
6593
+ // Count margin delta separately to only add it after scroll gutter adjustment.
6594
+ // This is needed to make negative margins work with `outerHeight( true )` (gh-3982).
6720
6595
  if ( box === "margin" ) {
6721
- delta += jQuery.css( elem, box + cssExpand[ i ], true, styles );
6596
+ marginDelta += jQuery.css( elem, box + cssExpand[ i ], true, styles );
6722
6597
  }
6723
6598
 
6724
6599
  // If we get here with a content-box, we're seeking "padding" or "border" or "margin"
@@ -6769,7 +6644,7 @@ function boxModelAdjustment( elem, dimension, box, isBorderBox, styles, computed
6769
6644
  ) ) || 0;
6770
6645
  }
6771
6646
 
6772
- return delta;
6647
+ return delta + marginDelta;
6773
6648
  }
6774
6649
 
6775
6650
  function getWidthOrHeight( elem, dimension, extra ) {
@@ -6867,26 +6742,35 @@ jQuery.extend( {
6867
6742
 
6868
6743
  // Don't automatically add "px" to these possibly-unitless properties
6869
6744
  cssNumber: {
6870
- "animationIterationCount": true,
6871
- "columnCount": true,
6872
- "fillOpacity": true,
6873
- "flexGrow": true,
6874
- "flexShrink": true,
6875
- "fontWeight": true,
6876
- "gridArea": true,
6877
- "gridColumn": true,
6878
- "gridColumnEnd": true,
6879
- "gridColumnStart": true,
6880
- "gridRow": true,
6881
- "gridRowEnd": true,
6882
- "gridRowStart": true,
6883
- "lineHeight": true,
6884
- "opacity": true,
6885
- "order": true,
6886
- "orphans": true,
6887
- "widows": true,
6888
- "zIndex": true,
6889
- "zoom": true
6745
+ animationIterationCount: true,
6746
+ aspectRatio: true,
6747
+ borderImageSlice: true,
6748
+ columnCount: true,
6749
+ flexGrow: true,
6750
+ flexShrink: true,
6751
+ fontWeight: true,
6752
+ gridArea: true,
6753
+ gridColumn: true,
6754
+ gridColumnEnd: true,
6755
+ gridColumnStart: true,
6756
+ gridRow: true,
6757
+ gridRowEnd: true,
6758
+ gridRowStart: true,
6759
+ lineHeight: true,
6760
+ opacity: true,
6761
+ order: true,
6762
+ orphans: true,
6763
+ scale: true,
6764
+ widows: true,
6765
+ zIndex: true,
6766
+ zoom: true,
6767
+
6768
+ // SVG-related
6769
+ fillOpacity: true,
6770
+ floodOpacity: true,
6771
+ stopOpacity: true,
6772
+ strokeMiterlimit: true,
6773
+ strokeOpacity: true
6890
6774
  },
6891
6775
 
6892
6776
  // Add in properties whose names you wish to fix before
@@ -6921,15 +6805,15 @@ jQuery.extend( {
6921
6805
  if ( value !== undefined ) {
6922
6806
  type = typeof value;
6923
6807
 
6924
- // Convert "+=" or "-=" to relative numbers (#7345)
6808
+ // Convert "+=" or "-=" to relative numbers (trac-7345)
6925
6809
  if ( type === "string" && ( ret = rcssNum.exec( value ) ) && ret[ 1 ] ) {
6926
6810
  value = adjustCSS( elem, name, ret );
6927
6811
 
6928
- // Fixes bug #9237
6812
+ // Fixes bug trac-9237
6929
6813
  type = "number";
6930
6814
  }
6931
6815
 
6932
- // Make sure that null and NaN values aren't set (#7116)
6816
+ // Make sure that null and NaN values aren't set (trac-7116)
6933
6817
  if ( value == null || value !== value ) {
6934
6818
  return;
6935
6819
  }
@@ -7553,7 +7437,7 @@ function Animation( elem, properties, options ) {
7553
7437
  remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),
7554
7438
 
7555
7439
  // Support: Android 2.3 only
7556
- // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497)
7440
+ // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (trac-12497)
7557
7441
  temp = remaining / animation.duration || 0,
7558
7442
  percent = 1 - temp,
7559
7443
  index = 0,
@@ -7943,7 +7827,6 @@ jQuery.fx.speeds = {
7943
7827
 
7944
7828
 
7945
7829
  // Based off of the plugin by Clint Helfers, with permission.
7946
- // https://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/
7947
7830
  jQuery.fn.delay = function( time, type ) {
7948
7831
  time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;
7949
7832
  type = type || "fx";
@@ -8168,8 +8051,7 @@ jQuery.extend( {
8168
8051
  // Support: IE <=9 - 11 only
8169
8052
  // elem.tabIndex doesn't always return the
8170
8053
  // correct value when it hasn't been explicitly set
8171
- // https://web.archive.org/web/20141116233347/http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
8172
- // Use proper attribute retrieval(#12072)
8054
+ // Use proper attribute retrieval (trac-12072)
8173
8055
  var tabindex = jQuery.find.attr( elem, "tabindex" );
8174
8056
 
8175
8057
  if ( tabindex ) {
@@ -8273,8 +8155,7 @@ function classesToArray( value ) {
8273
8155
 
8274
8156
  jQuery.fn.extend( {
8275
8157
  addClass: function( value ) {
8276
- var classes, elem, cur, curValue, clazz, j, finalValue,
8277
- i = 0;
8158
+ var classNames, cur, curValue, className, i, finalValue;
8278
8159
 
8279
8160
  if ( isFunction( value ) ) {
8280
8161
  return this.each( function( j ) {
@@ -8282,36 +8163,35 @@ jQuery.fn.extend( {
8282
8163
  } );
8283
8164
  }
8284
8165
 
8285
- classes = classesToArray( value );
8166
+ classNames = classesToArray( value );
8286
8167
 
8287
- if ( classes.length ) {
8288
- while ( ( elem = this[ i++ ] ) ) {
8289
- curValue = getClass( elem );
8290
- cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
8168
+ if ( classNames.length ) {
8169
+ return this.each( function() {
8170
+ curValue = getClass( this );
8171
+ cur = this.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
8291
8172
 
8292
8173
  if ( cur ) {
8293
- j = 0;
8294
- while ( ( clazz = classes[ j++ ] ) ) {
8295
- if ( cur.indexOf( " " + clazz + " " ) < 0 ) {
8296
- cur += clazz + " ";
8174
+ for ( i = 0; i < classNames.length; i++ ) {
8175
+ className = classNames[ i ];
8176
+ if ( cur.indexOf( " " + className + " " ) < 0 ) {
8177
+ cur += className + " ";
8297
8178
  }
8298
8179
  }
8299
8180
 
8300
8181
  // Only assign if different to avoid unneeded rendering.
8301
8182
  finalValue = stripAndCollapse( cur );
8302
8183
  if ( curValue !== finalValue ) {
8303
- elem.setAttribute( "class", finalValue );
8184
+ this.setAttribute( "class", finalValue );
8304
8185
  }
8305
8186
  }
8306
- }
8187
+ } );
8307
8188
  }
8308
8189
 
8309
8190
  return this;
8310
8191
  },
8311
8192
 
8312
8193
  removeClass: function( value ) {
8313
- var classes, elem, cur, curValue, clazz, j, finalValue,
8314
- i = 0;
8194
+ var classNames, cur, curValue, className, i, finalValue;
8315
8195
 
8316
8196
  if ( isFunction( value ) ) {
8317
8197
  return this.each( function( j ) {
@@ -8323,45 +8203,42 @@ jQuery.fn.extend( {
8323
8203
  return this.attr( "class", "" );
8324
8204
  }
8325
8205
 
8326
- classes = classesToArray( value );
8206
+ classNames = classesToArray( value );
8327
8207
 
8328
- if ( classes.length ) {
8329
- while ( ( elem = this[ i++ ] ) ) {
8330
- curValue = getClass( elem );
8208
+ if ( classNames.length ) {
8209
+ return this.each( function() {
8210
+ curValue = getClass( this );
8331
8211
 
8332
8212
  // This expression is here for better compressibility (see addClass)
8333
- cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
8213
+ cur = this.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
8334
8214
 
8335
8215
  if ( cur ) {
8336
- j = 0;
8337
- while ( ( clazz = classes[ j++ ] ) ) {
8216
+ for ( i = 0; i < classNames.length; i++ ) {
8217
+ className = classNames[ i ];
8338
8218
 
8339
8219
  // Remove *all* instances
8340
- while ( cur.indexOf( " " + clazz + " " ) > -1 ) {
8341
- cur = cur.replace( " " + clazz + " ", " " );
8220
+ while ( cur.indexOf( " " + className + " " ) > -1 ) {
8221
+ cur = cur.replace( " " + className + " ", " " );
8342
8222
  }
8343
8223
  }
8344
8224
 
8345
8225
  // Only assign if different to avoid unneeded rendering.
8346
8226
  finalValue = stripAndCollapse( cur );
8347
8227
  if ( curValue !== finalValue ) {
8348
- elem.setAttribute( "class", finalValue );
8228
+ this.setAttribute( "class", finalValue );
8349
8229
  }
8350
8230
  }
8351
- }
8231
+ } );
8352
8232
  }
8353
8233
 
8354
8234
  return this;
8355
8235
  },
8356
8236
 
8357
8237
  toggleClass: function( value, stateVal ) {
8358
- var type = typeof value,
8238
+ var classNames, className, i, self,
8239
+ type = typeof value,
8359
8240
  isValidValue = type === "string" || Array.isArray( value );
8360
8241
 
8361
- if ( typeof stateVal === "boolean" && isValidValue ) {
8362
- return stateVal ? this.addClass( value ) : this.removeClass( value );
8363
- }
8364
-
8365
8242
  if ( isFunction( value ) ) {
8366
8243
  return this.each( function( i ) {
8367
8244
  jQuery( this ).toggleClass(
@@ -8371,17 +8248,20 @@ jQuery.fn.extend( {
8371
8248
  } );
8372
8249
  }
8373
8250
 
8374
- return this.each( function() {
8375
- var className, i, self, classNames;
8251
+ if ( typeof stateVal === "boolean" && isValidValue ) {
8252
+ return stateVal ? this.addClass( value ) : this.removeClass( value );
8253
+ }
8376
8254
 
8255
+ classNames = classesToArray( value );
8256
+
8257
+ return this.each( function() {
8377
8258
  if ( isValidValue ) {
8378
8259
 
8379
8260
  // Toggle individual class names
8380
- i = 0;
8381
8261
  self = jQuery( this );
8382
- classNames = classesToArray( value );
8383
8262
 
8384
- while ( ( className = classNames[ i++ ] ) ) {
8263
+ for ( i = 0; i < classNames.length; i++ ) {
8264
+ className = classNames[ i ];
8385
8265
 
8386
8266
  // Check each className given, space separated list
8387
8267
  if ( self.hasClass( className ) ) {
@@ -8515,7 +8395,7 @@ jQuery.extend( {
8515
8395
  val :
8516
8396
 
8517
8397
  // Support: IE <=10 - 11 only
8518
- // option.text throws exceptions (#14686, #14858)
8398
+ // option.text throws exceptions (trac-14686, trac-14858)
8519
8399
  // Strip and collapse whitespace
8520
8400
  // https://html.spec.whatwg.org/#strip-and-collapse-whitespace
8521
8401
  stripAndCollapse( jQuery.text( elem ) );
@@ -8542,7 +8422,7 @@ jQuery.extend( {
8542
8422
  option = options[ i ];
8543
8423
 
8544
8424
  // Support: IE <=9 only
8545
- // IE8-9 doesn't update selected after form reset (#2551)
8425
+ // IE8-9 doesn't update selected after form reset (trac-2551)
8546
8426
  if ( ( option.selected || i === index ) &&
8547
8427
 
8548
8428
  // Don't return options that are disabled or in a disabled optgroup
@@ -8616,9 +8496,39 @@ jQuery.each( [ "radio", "checkbox" ], function() {
8616
8496
 
8617
8497
 
8618
8498
  // Return jQuery for attributes-only inclusion
8499
+ var location = window.location;
8500
+
8501
+ var nonce = { guid: Date.now() };
8619
8502
 
8503
+ var rquery = ( /\?/ );
8504
+
8505
+
8506
+
8507
+ // Cross-browser xml parsing
8508
+ jQuery.parseXML = function( data ) {
8509
+ var xml, parserErrorElem;
8510
+ if ( !data || typeof data !== "string" ) {
8511
+ return null;
8512
+ }
8513
+
8514
+ // Support: IE 9 - 11 only
8515
+ // IE throws on parseFromString with invalid input.
8516
+ try {
8517
+ xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" );
8518
+ } catch ( e ) {}
8620
8519
 
8621
- support.focusin = "onfocusin" in window;
8520
+ parserErrorElem = xml && xml.getElementsByTagName( "parsererror" )[ 0 ];
8521
+ if ( !xml || parserErrorElem ) {
8522
+ jQuery.error( "Invalid XML: " + (
8523
+ parserErrorElem ?
8524
+ jQuery.map( parserErrorElem.childNodes, function( el ) {
8525
+ return el.textContent;
8526
+ } ).join( "\n" ) :
8527
+ data
8528
+ ) );
8529
+ }
8530
+ return xml;
8531
+ };
8622
8532
 
8623
8533
 
8624
8534
  var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
@@ -8685,8 +8595,8 @@ jQuery.extend( jQuery.event, {
8685
8595
  return;
8686
8596
  }
8687
8597
 
8688
- // Determine event propagation path in advance, per W3C events spec (#9951)
8689
- // Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
8598
+ // Determine event propagation path in advance, per W3C events spec (trac-9951)
8599
+ // Bubble up to document, then to window; watch for a global ownerDocument var (trac-9724)
8690
8600
  if ( !onlyHandlers && !special.noBubble && !isWindow( elem ) ) {
8691
8601
 
8692
8602
  bubbleType = special.delegateType || type;
@@ -8738,7 +8648,7 @@ jQuery.extend( jQuery.event, {
8738
8648
  acceptData( elem ) ) {
8739
8649
 
8740
8650
  // Call a native DOM method on the target with the same name as the event.
8741
- // Don't do default actions on window, that's where global variables be (#6170)
8651
+ // Don't do default actions on window, that's where global variables be (trac-6170)
8742
8652
  if ( ontype && isFunction( elem[ type ] ) && !isWindow( elem ) ) {
8743
8653
 
8744
8654
  // Don't re-trigger an onFOO event when we call its FOO() method
@@ -8806,85 +8716,6 @@ jQuery.fn.extend( {
8806
8716
  } );
8807
8717
 
8808
8718
 
8809
- // Support: Firefox <=44
8810
- // Firefox doesn't have focus(in | out) events
8811
- // Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787
8812
- //
8813
- // Support: Chrome <=48 - 49, Safari <=9.0 - 9.1
8814
- // focus(in | out) events fire after focus & blur events,
8815
- // which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order
8816
- // Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857
8817
- if ( !support.focusin ) {
8818
- jQuery.each( { focus: "focusin", blur: "focusout" }, function( orig, fix ) {
8819
-
8820
- // Attach a single capturing handler on the document while someone wants focusin/focusout
8821
- var handler = function( event ) {
8822
- jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ) );
8823
- };
8824
-
8825
- jQuery.event.special[ fix ] = {
8826
- setup: function() {
8827
-
8828
- // Handle: regular nodes (via `this.ownerDocument`), window
8829
- // (via `this.document`) & document (via `this`).
8830
- var doc = this.ownerDocument || this.document || this,
8831
- attaches = dataPriv.access( doc, fix );
8832
-
8833
- if ( !attaches ) {
8834
- doc.addEventListener( orig, handler, true );
8835
- }
8836
- dataPriv.access( doc, fix, ( attaches || 0 ) + 1 );
8837
- },
8838
- teardown: function() {
8839
- var doc = this.ownerDocument || this.document || this,
8840
- attaches = dataPriv.access( doc, fix ) - 1;
8841
-
8842
- if ( !attaches ) {
8843
- doc.removeEventListener( orig, handler, true );
8844
- dataPriv.remove( doc, fix );
8845
-
8846
- } else {
8847
- dataPriv.access( doc, fix, attaches );
8848
- }
8849
- }
8850
- };
8851
- } );
8852
- }
8853
- var location = window.location;
8854
-
8855
- var nonce = { guid: Date.now() };
8856
-
8857
- var rquery = ( /\?/ );
8858
-
8859
-
8860
-
8861
- // Cross-browser xml parsing
8862
- jQuery.parseXML = function( data ) {
8863
- var xml, parserErrorElem;
8864
- if ( !data || typeof data !== "string" ) {
8865
- return null;
8866
- }
8867
-
8868
- // Support: IE 9 - 11 only
8869
- // IE throws on parseFromString with invalid input.
8870
- try {
8871
- xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" );
8872
- } catch ( e ) {}
8873
-
8874
- parserErrorElem = xml && xml.getElementsByTagName( "parsererror" )[ 0 ];
8875
- if ( !xml || parserErrorElem ) {
8876
- jQuery.error( "Invalid XML: " + (
8877
- parserErrorElem ?
8878
- jQuery.map( parserErrorElem.childNodes, function( el ) {
8879
- return el.textContent;
8880
- } ).join( "\n" ) :
8881
- data
8882
- ) );
8883
- }
8884
- return xml;
8885
- };
8886
-
8887
-
8888
8719
  var
8889
8720
  rbracket = /\[\]$/,
8890
8721
  rCRLF = /\r?\n/g,
@@ -9012,7 +8843,7 @@ var
9012
8843
  rantiCache = /([?&])_=[^&]*/,
9013
8844
  rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg,
9014
8845
 
9015
- // #7653, #8125, #8152: local protocol detection
8846
+ // trac-7653, trac-8125, trac-8152: local protocol detection
9016
8847
  rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
9017
8848
  rnoContent = /^(?:GET|HEAD)$/,
9018
8849
  rprotocol = /^\/\//,
@@ -9035,7 +8866,7 @@ var
9035
8866
  */
9036
8867
  transports = {},
9037
8868
 
9038
- // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
8869
+ // Avoid comment-prolog char sequence (trac-10098); must appease lint and evade compression
9039
8870
  allTypes = "*/".concat( "*" ),
9040
8871
 
9041
8872
  // Anchor tag for parsing the document origin
@@ -9106,7 +8937,7 @@ function inspectPrefiltersOrTransports( structure, options, originalOptions, jqX
9106
8937
 
9107
8938
  // A special extend for ajax options
9108
8939
  // that takes "flat" options (not to be deep extended)
9109
- // Fixes #9887
8940
+ // Fixes trac-9887
9110
8941
  function ajaxExtend( target, src ) {
9111
8942
  var key, deep,
9112
8943
  flatOptions = jQuery.ajaxSettings.flatOptions || {};
@@ -9517,12 +9348,12 @@ jQuery.extend( {
9517
9348
  deferred.promise( jqXHR );
9518
9349
 
9519
9350
  // Add protocol if not provided (prefilters might expect it)
9520
- // Handle falsy url in the settings object (#10093: consistency with old signature)
9351
+ // Handle falsy url in the settings object (trac-10093: consistency with old signature)
9521
9352
  // We also use the url parameter if available
9522
9353
  s.url = ( ( url || s.url || location.href ) + "" )
9523
9354
  .replace( rprotocol, location.protocol + "//" );
9524
9355
 
9525
- // Alias method option to type as per ticket #12004
9356
+ // Alias method option to type as per ticket trac-12004
9526
9357
  s.type = options.method || options.type || s.method || s.type;
9527
9358
 
9528
9359
  // Extract dataTypes list
@@ -9565,7 +9396,7 @@ jQuery.extend( {
9565
9396
  }
9566
9397
 
9567
9398
  // We can fire global events as of now if asked to
9568
- // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118)
9399
+ // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (trac-15118)
9569
9400
  fireGlobals = jQuery.event && s.global;
9570
9401
 
9571
9402
  // Watch for a new set of requests
@@ -9594,7 +9425,7 @@ jQuery.extend( {
9594
9425
  if ( s.data && ( s.processData || typeof s.data === "string" ) ) {
9595
9426
  cacheURL += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data;
9596
9427
 
9597
- // #9682: remove data so that it's not used in an eventual retry
9428
+ // trac-9682: remove data so that it's not used in an eventual retry
9598
9429
  delete s.data;
9599
9430
  }
9600
9431
 
@@ -9867,7 +9698,7 @@ jQuery._evalUrl = function( url, options, doc ) {
9867
9698
  return jQuery.ajax( {
9868
9699
  url: url,
9869
9700
 
9870
- // Make this explicit, since user can override this through ajaxSetup (#11264)
9701
+ // Make this explicit, since user can override this through ajaxSetup (trac-11264)
9871
9702
  type: "GET",
9872
9703
  dataType: "script",
9873
9704
  cache: true,
@@ -9976,7 +9807,7 @@ var xhrSuccessStatus = {
9976
9807
  0: 200,
9977
9808
 
9978
9809
  // Support: IE <=9 only
9979
- // #1450: sometimes IE returns 1223 when it should be 204
9810
+ // trac-1450: sometimes IE returns 1223 when it should be 204
9980
9811
  1223: 204
9981
9812
  },
9982
9813
  xhrSupported = jQuery.ajaxSettings.xhr();
@@ -10048,7 +9879,7 @@ jQuery.ajaxTransport( function( options ) {
10048
9879
  } else {
10049
9880
  complete(
10050
9881
 
10051
- // File: protocol always yields status 0; see #8605, #14207
9882
+ // File: protocol always yields status 0; see trac-8605, trac-14207
10052
9883
  xhr.status,
10053
9884
  xhr.statusText
10054
9885
  );
@@ -10109,7 +9940,7 @@ jQuery.ajaxTransport( function( options ) {
10109
9940
  xhr.send( options.hasContent && options.data || null );
10110
9941
  } catch ( e ) {
10111
9942
 
10112
- // #14683: Only rethrow if this hasn't been notified as an error yet
9943
+ // trac-14683: Only rethrow if this hasn't been notified as an error yet
10113
9944
  if ( callback ) {
10114
9945
  throw e;
10115
9946
  }
@@ -10729,7 +10560,9 @@ jQuery.fn.extend( {
10729
10560
  },
10730
10561
 
10731
10562
  hover: function( fnOver, fnOut ) {
10732
- return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
10563
+ return this
10564
+ .on( "mouseenter", fnOver )
10565
+ .on( "mouseleave", fnOut || fnOver );
10733
10566
  }
10734
10567
  } );
10735
10568
 
@@ -10753,7 +10586,9 @@ jQuery.each(
10753
10586
 
10754
10587
  // Support: Android <=4.0 only
10755
10588
  // Make sure we trim BOM and NBSP
10756
- var rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;
10589
+ // Require that the "whitespace run" starts from a non-whitespace
10590
+ // to avoid O(N^2) behavior when the engine would try matching "\s+$" at each space position.
10591
+ var rtrim = /^[\s\uFEFF\xA0]+|([^\s\uFEFF\xA0])[\s\uFEFF\xA0]+$/g;
10757
10592
 
10758
10593
  // Bind a function to a context, optionally partially applying any
10759
10594
  // arguments.
@@ -10820,7 +10655,7 @@ jQuery.isNumeric = function( obj ) {
10820
10655
  jQuery.trim = function( text ) {
10821
10656
  return text == null ?
10822
10657
  "" :
10823
- ( text + "" ).replace( rtrim, "" );
10658
+ ( text + "" ).replace( rtrim, "$1" );
10824
10659
  };
10825
10660
 
10826
10661
 
@@ -10868,8 +10703,8 @@ jQuery.noConflict = function( deep ) {
10868
10703
  };
10869
10704
 
10870
10705
  // Expose jQuery and $ identifiers, even in AMD
10871
- // (#7102#comment:10, https://github.com/jquery/jquery/pull/557)
10872
- // and CommonJS for browser emulators (#13566)
10706
+ // (trac-7102#comment:10, https://github.com/jquery/jquery/pull/557)
10707
+ // and CommonJS for browser emulators (trac-13566)
10873
10708
  if ( typeof noGlobal === "undefined" ) {
10874
10709
  window.jQuery = window.$ = jQuery;
10875
10710
  }