jqtree 1.7.0 → 1.7.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.
Files changed (68) hide show
  1. package/.github/workflows/ci.yml +2 -10
  2. package/.github/workflows/codeql-analysis.yml +2 -2
  3. package/bower.json +1 -1
  4. package/docs/Gemfile.lock +34 -37
  5. package/docs/_config.yml +1 -1
  6. package/docs/_entries/10_changelog.md +4 -0
  7. package/docs/package.json +7 -7
  8. package/docs/pnpm-lock.yaml +387 -269
  9. package/docs/static/bower.json +2 -2
  10. package/docs/static/bower_components/fontawesome/css/all.min.css +6 -2
  11. package/docs/static/bower_components/fontawesome/webfonts/fa-brands-400.ttf +0 -0
  12. package/docs/static/bower_components/fontawesome/webfonts/fa-brands-400.woff2 +0 -0
  13. package/docs/static/bower_components/fontawesome/webfonts/fa-regular-400.ttf +0 -0
  14. package/docs/static/bower_components/fontawesome/webfonts/fa-regular-400.woff2 +0 -0
  15. package/docs/static/bower_components/fontawesome/webfonts/fa-solid-900.ttf +0 -0
  16. package/docs/static/bower_components/fontawesome/webfonts/fa-solid-900.woff2 +0 -0
  17. package/docs/static/bower_components/fontawesome/webfonts/fa-v4compatibility.ttf +0 -0
  18. package/docs/static/bower_components/fontawesome/webfonts/fa-v4compatibility.woff2 +0 -0
  19. package/docs/static/bower_components/jquery/dist/jquery.js +813 -1102
  20. package/docs/static/bower_components/jquery/dist/jquery.min.js +2 -2
  21. package/docs/static/documentation.css +104 -222
  22. package/docs/tree.jquery.js +3 -3
  23. package/lib/dragAndDropHandler.js +21 -10
  24. package/lib/elementsRenderer.js +25 -15
  25. package/lib/mouse.widget.js +12 -1
  26. package/lib/node.js +13 -10
  27. package/lib/nodeElement.js +19 -12
  28. package/lib/saveStateHandler.js +1 -1
  29. package/lib/scrollHandler.js +7 -3
  30. package/lib/selectNodeHandler.js +1 -1
  31. package/lib/simple.widget.js +2 -0
  32. package/lib/test/jqTree/accessibility.test.js +37 -0
  33. package/lib/test/jqTree/events.test.js +73 -77
  34. package/lib/test/node.test.js +7 -4
  35. package/lib/version.js +1 -1
  36. package/package.json +36 -40
  37. package/src/dragAndDropHandler.ts +24 -10
  38. package/src/elementsRenderer.ts +49 -42
  39. package/src/jqtreeOptions.ts +3 -3
  40. package/src/mouse.widget.ts +12 -0
  41. package/src/node.ts +10 -5
  42. package/src/nodeElement.ts +27 -21
  43. package/src/saveStateHandler.ts +1 -1
  44. package/src/scrollHandler.ts +6 -2
  45. package/src/selectNodeHandler.ts +1 -1
  46. package/src/simple.widget.ts +2 -0
  47. package/src/test/jqTree/accessibility.test.ts +25 -0
  48. package/src/test/jqTree/events.test.ts +79 -93
  49. package/src/test/jqTree/methods.test.ts +1 -1
  50. package/src/test/node.test.ts +6 -4
  51. package/src/test/nodeUtil.test.ts +1 -1
  52. package/src/tree.jquery.ts +1 -1
  53. package/src/version.ts +1 -1
  54. package/tree.jquery.debug.js +100 -54
  55. package/tree.jquery.debug.js.map +1 -1
  56. package/tree.jquery.js +3 -3
  57. package/tree.jquery.js.map +1 -1
  58. package/tsconfig.json +1 -0
  59. package/.tool-versions +0 -1
  60. package/docs/static/bower_components/fontawesome/webfonts/fa-brands-400.eot +0 -0
  61. package/docs/static/bower_components/fontawesome/webfonts/fa-brands-400.svg +0 -3717
  62. package/docs/static/bower_components/fontawesome/webfonts/fa-brands-400.woff +0 -0
  63. package/docs/static/bower_components/fontawesome/webfonts/fa-regular-400.eot +0 -0
  64. package/docs/static/bower_components/fontawesome/webfonts/fa-regular-400.svg +0 -801
  65. package/docs/static/bower_components/fontawesome/webfonts/fa-regular-400.woff +0 -0
  66. package/docs/static/bower_components/fontawesome/webfonts/fa-solid-900.eot +0 -0
  67. package/docs/static/bower_components/fontawesome/webfonts/fa-solid-900.svg +0 -5028
  68. package/docs/static/bower_components/fontawesome/webfonts/fa-solid-900.woff +0 -0
@@ -1,15 +1,12 @@
1
1
  /*!
2
- * jQuery JavaScript Library v3.6.3
2
+ * jQuery JavaScript Library v3.7.0
3
3
  * https://jquery.com/
4
4
  *
5
- * Includes Sizzle.js
6
- * https://sizzlejs.com/
7
- *
8
5
  * Copyright OpenJS Foundation and other contributors
9
6
  * Released under the MIT license
10
7
  * https://jquery.org/license
11
8
  *
12
- * Date: 2022-12-20T21:28Z
9
+ * Date: 2023-05-11T18:29Z
13
10
  */
14
11
  ( function( global, factory ) {
15
12
 
@@ -150,8 +147,9 @@ function toType( obj ) {
150
147
 
151
148
 
152
149
 
153
- var
154
- version = "3.6.3",
150
+ var version = "3.7.0",
151
+
152
+ rhtmlSuffix = /HTML$/i,
155
153
 
156
154
  // Define a local copy of jQuery
157
155
  jQuery = function( selector, context ) {
@@ -397,6 +395,33 @@ jQuery.extend( {
397
395
  return obj;
398
396
  },
399
397
 
398
+
399
+ // Retrieve the text value of an array of DOM nodes
400
+ text: function( elem ) {
401
+ var node,
402
+ ret = "",
403
+ i = 0,
404
+ nodeType = elem.nodeType;
405
+
406
+ if ( !nodeType ) {
407
+
408
+ // If no nodeType, this is expected to be an array
409
+ while ( ( node = elem[ i++ ] ) ) {
410
+
411
+ // Do not traverse comment nodes
412
+ ret += jQuery.text( node );
413
+ }
414
+ } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
415
+ return elem.textContent;
416
+ } else if ( nodeType === 3 || nodeType === 4 ) {
417
+ return elem.nodeValue;
418
+ }
419
+
420
+ // Do not include comment or processing instruction nodes
421
+
422
+ return ret;
423
+ },
424
+
400
425
  // results is for internal usage only
401
426
  makeArray: function( arr, results ) {
402
427
  var ret = results || [];
@@ -419,6 +444,15 @@ jQuery.extend( {
419
444
  return arr == null ? -1 : indexOf.call( arr, elem, i );
420
445
  },
421
446
 
447
+ isXMLDoc: function( elem ) {
448
+ var namespace = elem && elem.namespaceURI,
449
+ docElem = elem && ( elem.ownerDocument || elem ).documentElement;
450
+
451
+ // Assume HTML when documentElement doesn't yet exist, such as inside
452
+ // document fragments.
453
+ return !rhtmlSuffix.test( namespace || docElem && docElem.nodeName || "HTML" );
454
+ },
455
+
422
456
  // Support: Android <=4.0 only, PhantomJS 1 only
423
457
  // push.apply(_, arraylike) throws on ancient WebKit
424
458
  merge: function( first, second ) {
@@ -520,43 +554,98 @@ function isArrayLike( obj ) {
520
554
  return type === "array" || length === 0 ||
521
555
  typeof length === "number" && length > 0 && ( length - 1 ) in obj;
522
556
  }
523
- var Sizzle =
524
- /*!
525
- * Sizzle CSS Selector Engine v2.3.9
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: 2022-12-19
533
- */
534
- ( function( window ) {
557
+
558
+
559
+ function nodeName( elem, name ) {
560
+
561
+ return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
562
+
563
+ }
564
+ var pop = arr.pop;
565
+
566
+
567
+ var sort = arr.sort;
568
+
569
+
570
+ var splice = arr.splice;
571
+
572
+
573
+ var whitespace = "[\\x20\\t\\r\\n\\f]";
574
+
575
+
576
+ var rtrimCSS = new RegExp(
577
+ "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$",
578
+ "g"
579
+ );
580
+
581
+
582
+
583
+
584
+ // Note: an element does not contain itself
585
+ jQuery.contains = function( a, b ) {
586
+ var bup = b && b.parentNode;
587
+
588
+ return a === bup || !!( bup && bup.nodeType === 1 && (
589
+
590
+ // Support: IE 9 - 11+
591
+ // IE doesn't have `contains` on SVG.
592
+ a.contains ?
593
+ a.contains( bup ) :
594
+ a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
595
+ ) );
596
+ };
597
+
598
+
599
+
600
+
601
+ // CSS string/identifier serialization
602
+ // https://drafts.csswg.org/cssom/#common-serializing-idioms
603
+ var rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\x80-\uFFFF\w-]/g;
604
+
605
+ function fcssescape( ch, asCodePoint ) {
606
+ if ( asCodePoint ) {
607
+
608
+ // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER
609
+ if ( ch === "\0" ) {
610
+ return "\uFFFD";
611
+ }
612
+
613
+ // Control characters and (dependent upon position) numbers get escaped as code points
614
+ return ch.slice( 0, -1 ) + "\\" + ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " ";
615
+ }
616
+
617
+ // Other potentially-special ASCII characters get backslash-escaped
618
+ return "\\" + ch;
619
+ }
620
+
621
+ jQuery.escapeSelector = function( sel ) {
622
+ return ( sel + "" ).replace( rcssescape, fcssescape );
623
+ };
624
+
625
+
626
+
627
+
628
+ var preferredDoc = document,
629
+ pushNative = push;
630
+
631
+ ( function() {
632
+
535
633
  var i,
536
- support,
537
634
  Expr,
538
- getText,
539
- isXML,
540
- tokenize,
541
- compile,
542
- select,
543
635
  outermostContext,
544
636
  sortInput,
545
637
  hasDuplicate,
638
+ push = pushNative,
546
639
 
547
640
  // Local document vars
548
- setDocument,
549
641
  document,
550
- docElem,
642
+ documentElement,
551
643
  documentIsHTML,
552
644
  rbuggyQSA,
553
- rbuggyMatches,
554
645
  matches,
555
- contains,
556
646
 
557
647
  // Instance-specific data
558
- expando = "sizzle" + 1 * new Date(),
559
- preferredDoc = window.document,
648
+ expando = jQuery.expando,
560
649
  dirruns = 0,
561
650
  done = 0,
562
651
  classCache = createCache(),
@@ -570,47 +659,22 @@ var i,
570
659
  return 0;
571
660
  },
572
661
 
573
- // Instance methods
574
- hasOwn = ( {} ).hasOwnProperty,
575
- arr = [],
576
- pop = arr.pop,
577
- pushNative = arr.push,
578
- push = arr.push,
579
- slice = arr.slice,
580
-
581
- // Use a stripped-down indexOf as it's faster than native
582
- // https://jsperf.com/thor-indexof-vs-for/5
583
- indexOf = function( list, elem ) {
584
- var i = 0,
585
- len = list.length;
586
- for ( ; i < len; i++ ) {
587
- if ( list[ i ] === elem ) {
588
- return i;
589
- }
590
- }
591
- return -1;
592
- },
593
-
594
- booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|" +
595
- "ismap|loop|multiple|open|readonly|required|scoped",
662
+ booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|" +
663
+ "loop|multiple|open|readonly|required|scoped",
596
664
 
597
665
  // Regular expressions
598
666
 
599
- // http://www.w3.org/TR/css3-selectors/#whitespace
600
- whitespace = "[\\x20\\t\\r\\n\\f]",
601
-
602
667
  // https://www.w3.org/TR/css-syntax-3/#ident-token-diagram
603
668
  identifier = "(?:\\\\[\\da-fA-F]{1,6}" + whitespace +
604
669
  "?|\\\\[^\\r\\n\\f]|[\\w-]|[^\0-\\x7f])+",
605
670
 
606
- // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors
671
+ // Attribute selectors: https://www.w3.org/TR/selectors/#attribute-selectors
607
672
  attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace +
608
673
 
609
674
  // Operator (capture 2)
610
675
  "*([*^$|!~]?=)" + whitespace +
611
676
 
612
- // "Attribute values must be CSS identifiers [capture 5]
613
- // or strings [capture 3 or capture 4]"
677
+ // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]"
614
678
  "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" +
615
679
  whitespace + "*\\]",
616
680
 
@@ -629,101 +693,88 @@ var i,
629
693
 
630
694
  // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
631
695
  rwhitespace = new RegExp( whitespace + "+", "g" ),
632
- rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" +
633
- whitespace + "+$", "g" ),
634
696
 
635
697
  rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
636
- rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace +
637
- "*" ),
698
+ rleadingCombinator = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" +
699
+ whitespace + "*" ),
638
700
  rdescend = new RegExp( whitespace + "|>" ),
639
701
 
640
702
  rpseudo = new RegExp( pseudos ),
641
703
  ridentifier = new RegExp( "^" + identifier + "$" ),
642
704
 
643
705
  matchExpr = {
644
- "ID": new RegExp( "^#(" + identifier + ")" ),
645
- "CLASS": new RegExp( "^\\.(" + identifier + ")" ),
646
- "TAG": new RegExp( "^(" + identifier + "|[*])" ),
647
- "ATTR": new RegExp( "^" + attributes ),
648
- "PSEUDO": new RegExp( "^" + pseudos ),
649
- "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" +
650
- whitespace + "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" +
651
- whitespace + "*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
652
- "bool": new RegExp( "^(?:" + booleans + ")$", "i" ),
706
+ ID: new RegExp( "^#(" + identifier + ")" ),
707
+ CLASS: new RegExp( "^\\.(" + identifier + ")" ),
708
+ TAG: new RegExp( "^(" + identifier + "|[*])" ),
709
+ ATTR: new RegExp( "^" + attributes ),
710
+ PSEUDO: new RegExp( "^" + pseudos ),
711
+ CHILD: new RegExp(
712
+ "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" +
713
+ whitespace + "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" +
714
+ whitespace + "*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
715
+ bool: new RegExp( "^(?:" + booleans + ")$", "i" ),
653
716
 
654
717
  // For use in libraries implementing .is()
655
718
  // We use this for POS matching in `select`
656
- "needsContext": new RegExp( "^" + whitespace +
719
+ needsContext: new RegExp( "^" + whitespace +
657
720
  "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + whitespace +
658
721
  "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )
659
722
  },
660
723
 
661
- rhtml = /HTML$/i,
662
724
  rinputs = /^(?:input|select|textarea|button)$/i,
663
725
  rheader = /^h\d$/i,
664
726
 
665
- rnative = /^[^{]+\{\s*\[native \w/,
666
-
667
727
  // Easily-parseable/retrievable ID or TAG or CLASS selectors
668
728
  rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
669
729
 
670
730
  rsibling = /[+~]/,
671
731
 
672
732
  // CSS escapes
673
- // http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
674
- runescape = new RegExp( "\\\\[\\da-fA-F]{1,6}" + whitespace + "?|\\\\([^\\r\\n\\f])", "g" ),
733
+ // https://www.w3.org/TR/CSS21/syndata.html#escaped-characters
734
+ runescape = new RegExp( "\\\\[\\da-fA-F]{1,6}" + whitespace +
735
+ "?|\\\\([^\\r\\n\\f])", "g" ),
675
736
  funescape = function( escape, nonHex ) {
676
737
  var high = "0x" + escape.slice( 1 ) - 0x10000;
677
738
 
678
- return nonHex ?
739
+ if ( nonHex ) {
679
740
 
680
741
  // Strip the backslash prefix from a non-hex escape sequence
681
- nonHex :
682
-
683
- // Replace a hexadecimal escape sequence with the encoded Unicode code point
684
- // Support: IE <=11+
685
- // For values outside the Basic Multilingual Plane (BMP), manually construct a
686
- // surrogate pair
687
- high < 0 ?
688
- String.fromCharCode( high + 0x10000 ) :
689
- String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
690
- },
691
-
692
- // CSS string/identifier serialization
693
- // https://drafts.csswg.org/cssom/#common-serializing-idioms
694
- rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,
695
- fcssescape = function( ch, asCodePoint ) {
696
- if ( asCodePoint ) {
697
-
698
- // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER
699
- if ( ch === "\0" ) {
700
- return "\uFFFD";
701
- }
702
-
703
- // Control characters and (dependent upon position) numbers get escaped as code points
704
- return ch.slice( 0, -1 ) + "\\" +
705
- ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " ";
742
+ return nonHex;
706
743
  }
707
744
 
708
- // Other potentially-special ASCII characters get backslash-escaped
709
- return "\\" + ch;
745
+ // Replace a hexadecimal escape sequence with the encoded Unicode code point
746
+ // Support: IE <=11+
747
+ // For values outside the Basic Multilingual Plane (BMP), manually construct a
748
+ // surrogate pair
749
+ return high < 0 ?
750
+ String.fromCharCode( high + 0x10000 ) :
751
+ String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
710
752
  },
711
753
 
712
- // Used for iframes
713
- // See setDocument()
754
+ // Used for iframes; see `setDocument`.
755
+ // Support: IE 9 - 11+, Edge 12 - 18+
714
756
  // Removing the function wrapper causes a "Permission Denied"
715
- // error in IE
757
+ // error in IE/Edge.
716
758
  unloadHandler = function() {
717
759
  setDocument();
718
760
  },
719
761
 
720
762
  inDisabledFieldset = addCombinator(
721
763
  function( elem ) {
722
- return elem.disabled === true && elem.nodeName.toLowerCase() === "fieldset";
764
+ return elem.disabled === true && nodeName( elem, "fieldset" );
723
765
  },
724
766
  { dir: "parentNode", next: "legend" }
725
767
  );
726
768
 
769
+ // Support: IE <=9 only
770
+ // Accessing document.activeElement can throw unexpectedly
771
+ // https://bugs.jquery.com/ticket/13393
772
+ function safeActiveElement() {
773
+ try {
774
+ return document.activeElement;
775
+ } catch ( err ) { }
776
+ }
777
+
727
778
  // Optimize for push.apply( _, NodeList )
728
779
  try {
729
780
  push.apply(
@@ -731,32 +782,22 @@ try {
731
782
  preferredDoc.childNodes
732
783
  );
733
784
 
734
- // Support: Android<4.0
785
+ // Support: Android <=4.0
735
786
  // Detect silently failing push.apply
736
787
  // eslint-disable-next-line no-unused-expressions
737
788
  arr[ preferredDoc.childNodes.length ].nodeType;
738
789
  } catch ( e ) {
739
- push = { apply: arr.length ?
740
-
741
- // Leverage slice if possible
742
- function( target, els ) {
790
+ push = {
791
+ apply: function( target, els ) {
743
792
  pushNative.apply( target, slice.call( els ) );
744
- } :
745
-
746
- // Support: IE<9
747
- // Otherwise append directly
748
- function( target, els ) {
749
- var j = target.length,
750
- i = 0;
751
-
752
- // Can't trust NodeList.length
753
- while ( ( target[ j++ ] = els[ i++ ] ) ) {}
754
- target.length = j - 1;
793
+ },
794
+ call: function( target ) {
795
+ pushNative.apply( target, slice.call( arguments, 1 ) );
755
796
  }
756
797
  };
757
798
  }
758
799
 
759
- function Sizzle( selector, context, results, seed ) {
800
+ function find( selector, context, results, seed ) {
760
801
  var m, i, elem, nid, match, groups, newSelector,
761
802
  newContext = context && context.ownerDocument,
762
803
 
@@ -790,11 +831,10 @@ function Sizzle( selector, context, results, seed ) {
790
831
  if ( nodeType === 9 ) {
791
832
  if ( ( elem = context.getElementById( m ) ) ) {
792
833
 
793
- // Support: IE, Opera, Webkit
794
- // TODO: identify versions
834
+ // Support: IE 9 only
795
835
  // getElementById can match elements by name instead of ID
796
836
  if ( elem.id === m ) {
797
- results.push( elem );
837
+ push.call( results, elem );
798
838
  return results;
799
839
  }
800
840
  } else {
@@ -804,14 +844,13 @@ function Sizzle( selector, context, results, seed ) {
804
844
  // Element context
805
845
  } else {
806
846
 
807
- // Support: IE, Opera, Webkit
808
- // TODO: identify versions
847
+ // Support: IE 9 only
809
848
  // getElementById can match elements by name instead of ID
810
849
  if ( newContext && ( elem = newContext.getElementById( m ) ) &&
811
- contains( context, elem ) &&
850
+ find.contains( context, elem ) &&
812
851
  elem.id === m ) {
813
852
 
814
- results.push( elem );
853
+ push.call( results, elem );
815
854
  return results;
816
855
  }
817
856
  }
@@ -822,22 +861,15 @@ function Sizzle( selector, context, results, seed ) {
822
861
  return results;
823
862
 
824
863
  // Class selector
825
- } else if ( ( m = match[ 3 ] ) && support.getElementsByClassName &&
826
- context.getElementsByClassName ) {
827
-
864
+ } else if ( ( m = match[ 3 ] ) && context.getElementsByClassName ) {
828
865
  push.apply( results, context.getElementsByClassName( m ) );
829
866
  return results;
830
867
  }
831
868
  }
832
869
 
833
870
  // Take advantage of querySelectorAll
834
- if ( support.qsa &&
835
- !nonnativeSelectorCache[ selector + " " ] &&
836
- ( !rbuggyQSA || !rbuggyQSA.test( selector ) ) &&
837
-
838
- // Support: IE 8 only
839
- // Exclude object elements
840
- ( nodeType !== 1 || context.nodeName.toLowerCase() !== "object" ) ) {
871
+ if ( !nonnativeSelectorCache[ selector + " " ] &&
872
+ ( !rbuggyQSA || !rbuggyQSA.test( selector ) ) ) {
841
873
 
842
874
  newSelector = selector;
843
875
  newContext = context;
@@ -850,7 +882,7 @@ function Sizzle( selector, context, results, seed ) {
850
882
  // as such selectors are not recognized by querySelectorAll.
851
883
  // Thanks to Andrew Dupont for this technique.
852
884
  if ( nodeType === 1 &&
853
- ( rdescend.test( selector ) || rcombinators.test( selector ) ) ) {
885
+ ( rdescend.test( selector ) || rleadingCombinator.test( selector ) ) ) {
854
886
 
855
887
  // Expand context for sibling selectors
856
888
  newContext = rsibling.test( selector ) && testContext( context.parentNode ) ||
@@ -858,11 +890,15 @@ function Sizzle( selector, context, results, seed ) {
858
890
 
859
891
  // We can use :scope instead of the ID hack if the browser
860
892
  // supports it & if we're not changing the context.
861
- if ( newContext !== context || !support.scope ) {
893
+ // Support: IE 11+, Edge 17 - 18+
894
+ // IE/Edge sometimes throw a "Permission denied" error when
895
+ // strict-comparing two documents; shallow comparisons work.
896
+ // eslint-disable-next-line eqeqeq
897
+ if ( newContext != context || !support.scope ) {
862
898
 
863
899
  // Capture the context ID, setting it first if necessary
864
900
  if ( ( nid = context.getAttribute( "id" ) ) ) {
865
- nid = nid.replace( rcssescape, fcssescape );
901
+ nid = jQuery.escapeSelector( nid );
866
902
  } else {
867
903
  context.setAttribute( "id", ( nid = expando ) );
868
904
  }
@@ -879,27 +915,6 @@ function Sizzle( selector, context, results, seed ) {
879
915
  }
880
916
 
881
917
  try {
882
-
883
- // `qSA` may not throw for unrecognized parts using forgiving parsing:
884
- // https://drafts.csswg.org/selectors/#forgiving-selector
885
- // like the `:has()` pseudo-class:
886
- // https://drafts.csswg.org/selectors/#relational
887
- // `CSS.supports` is still expected to return `false` then:
888
- // https://drafts.csswg.org/css-conditional-4/#typedef-supports-selector-fn
889
- // https://drafts.csswg.org/css-conditional-4/#dfn-support-selector
890
- if ( support.cssSupportsSelector &&
891
-
892
- // eslint-disable-next-line no-undef
893
- !CSS.supports( "selector(:is(" + newSelector + "))" ) ) {
894
-
895
- // Support: IE 11+
896
- // Throw to get to the same code path as an error directly in qSA.
897
- // Note: once we only support browser supporting
898
- // `CSS.supports('selector(...)')`, we can most likely drop
899
- // the `try-catch`. IE doesn't implement the API.
900
- throw new Error();
901
- }
902
-
903
918
  push.apply( results,
904
919
  newContext.querySelectorAll( newSelector )
905
920
  );
@@ -916,7 +931,7 @@ function Sizzle( selector, context, results, seed ) {
916
931
  }
917
932
 
918
933
  // All others
919
- return select( selector.replace( rtrim, "$1" ), context, results, seed );
934
+ return select( selector.replace( rtrimCSS, "$1" ), context, results, seed );
920
935
  }
921
936
 
922
937
  /**
@@ -930,7 +945,8 @@ function createCache() {
930
945
 
931
946
  function cache( key, value ) {
932
947
 
933
- // Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
948
+ // Use (key + " ") to avoid collision with native prototype properties
949
+ // (see https://github.com/jquery/sizzle/issues/157)
934
950
  if ( keys.push( key + " " ) > Expr.cacheLength ) {
935
951
 
936
952
  // Only keep the most recent entries
@@ -942,7 +958,7 @@ function createCache() {
942
958
  }
943
959
 
944
960
  /**
945
- * Mark a function for special use by Sizzle
961
+ * Mark a function for special use by jQuery selector module
946
962
  * @param {Function} fn The function to mark
947
963
  */
948
964
  function markFunction( fn ) {
@@ -973,56 +989,13 @@ function assert( fn ) {
973
989
  }
974
990
  }
975
991
 
976
- /**
977
- * Adds the same handler for all of the specified attrs
978
- * @param {String} attrs Pipe-separated list of attributes
979
- * @param {Function} handler The method that will be applied
980
- */
981
- function addHandle( attrs, handler ) {
982
- var arr = attrs.split( "|" ),
983
- i = arr.length;
984
-
985
- while ( i-- ) {
986
- Expr.attrHandle[ arr[ i ] ] = handler;
987
- }
988
- }
989
-
990
- /**
991
- * Checks document order of two siblings
992
- * @param {Element} a
993
- * @param {Element} b
994
- * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b
995
- */
996
- function siblingCheck( a, b ) {
997
- var cur = b && a,
998
- diff = cur && a.nodeType === 1 && b.nodeType === 1 &&
999
- a.sourceIndex - b.sourceIndex;
1000
-
1001
- // Use IE sourceIndex if available on both nodes
1002
- if ( diff ) {
1003
- return diff;
1004
- }
1005
-
1006
- // Check if b follows a
1007
- if ( cur ) {
1008
- while ( ( cur = cur.nextSibling ) ) {
1009
- if ( cur === b ) {
1010
- return -1;
1011
- }
1012
- }
1013
- }
1014
-
1015
- return a ? 1 : -1;
1016
- }
1017
-
1018
992
  /**
1019
993
  * Returns a function to use in pseudos for input types
1020
994
  * @param {String} type
1021
995
  */
1022
996
  function createInputPseudo( type ) {
1023
997
  return function( elem ) {
1024
- var name = elem.nodeName.toLowerCase();
1025
- return name === "input" && elem.type === type;
998
+ return nodeName( elem, "input" ) && elem.type === type;
1026
999
  };
1027
1000
  }
1028
1001
 
@@ -1032,8 +1005,8 @@ function createInputPseudo( type ) {
1032
1005
  */
1033
1006
  function createButtonPseudo( type ) {
1034
1007
  return function( elem ) {
1035
- var name = elem.nodeName.toLowerCase();
1036
- return ( name === "input" || name === "button" ) && elem.type === type;
1008
+ return ( nodeName( elem, "input" ) || nodeName( elem, "button" ) ) &&
1009
+ elem.type === type;
1037
1010
  };
1038
1011
  }
1039
1012
 
@@ -1069,14 +1042,13 @@ function createDisabledPseudo( disabled ) {
1069
1042
  }
1070
1043
  }
1071
1044
 
1072
- // Support: IE 6 - 11
1045
+ // Support: IE 6 - 11+
1073
1046
  // Use the isDisabled shortcut property to check for disabled fieldset ancestors
1074
1047
  return elem.isDisabled === disabled ||
1075
1048
 
1076
1049
  // Where there is no isDisabled, check manually
1077
- /* jshint -W018 */
1078
1050
  elem.isDisabled !== !disabled &&
1079
- inDisabledFieldset( elem ) === disabled;
1051
+ inDisabledFieldset( elem ) === disabled;
1080
1052
  }
1081
1053
 
1082
1054
  return elem.disabled === disabled;
@@ -1116,7 +1088,7 @@ function createPositionalPseudo( fn ) {
1116
1088
  }
1117
1089
 
1118
1090
  /**
1119
- * Checks a node for validity as a Sizzle context
1091
+ * Checks a node for validity as a jQuery selector context
1120
1092
  * @param {Element|Object=} context
1121
1093
  * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value
1122
1094
  */
@@ -1124,31 +1096,13 @@ function testContext( context ) {
1124
1096
  return context && typeof context.getElementsByTagName !== "undefined" && context;
1125
1097
  }
1126
1098
 
1127
- // Expose support vars for convenience
1128
- support = Sizzle.support = {};
1129
-
1130
- /**
1131
- * Detects XML nodes
1132
- * @param {Element|Object} elem An element or a document
1133
- * @returns {Boolean} True iff elem is a non-HTML XML node
1134
- */
1135
- isXML = Sizzle.isXML = function( elem ) {
1136
- var namespace = elem && elem.namespaceURI,
1137
- docElem = elem && ( elem.ownerDocument || elem ).documentElement;
1138
-
1139
- // Support: IE <=8
1140
- // Assume HTML when documentElement doesn't yet exist, such as inside loading iframes
1141
- // https://bugs.jquery.com/ticket/4833
1142
- return !rhtml.test( namespace || docElem && docElem.nodeName || "HTML" );
1143
- };
1144
-
1145
1099
  /**
1146
1100
  * Sets document-related variables once based on the current document
1147
- * @param {Element|Object} [doc] An element or document object to use to set the document
1101
+ * @param {Element|Object} [node] An element or document object to use to set the document
1148
1102
  * @returns {Object} Returns the current document
1149
1103
  */
1150
- setDocument = Sizzle.setDocument = function( node ) {
1151
- var hasCompare, subWindow,
1104
+ function setDocument( node ) {
1105
+ var subWindow,
1152
1106
  doc = node ? node.ownerDocument || node : preferredDoc;
1153
1107
 
1154
1108
  // Return early if doc is invalid or already selected
@@ -1162,11 +1116,17 @@ setDocument = Sizzle.setDocument = function( node ) {
1162
1116
 
1163
1117
  // Update global variables
1164
1118
  document = doc;
1165
- docElem = document.documentElement;
1166
- documentIsHTML = !isXML( document );
1119
+ documentElement = document.documentElement;
1120
+ documentIsHTML = !jQuery.isXMLDoc( document );
1121
+
1122
+ // Support: iOS 7 only, IE 9 - 11+
1123
+ // Older browsers didn't support unprefixed `matches`.
1124
+ matches = documentElement.matches ||
1125
+ documentElement.webkitMatchesSelector ||
1126
+ documentElement.msMatchesSelector;
1167
1127
 
1168
1128
  // Support: IE 9 - 11+, Edge 12 - 18+
1169
- // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936)
1129
+ // Accessing iframe documents after unload throws "permission denied" errors (see trac-13936)
1170
1130
  // Support: IE 11+, Edge 17 - 18+
1171
1131
  // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
1172
1132
  // two documents; shallow comparisons work.
@@ -1174,100 +1134,67 @@ setDocument = Sizzle.setDocument = function( node ) {
1174
1134
  if ( preferredDoc != document &&
1175
1135
  ( subWindow = document.defaultView ) && subWindow.top !== subWindow ) {
1176
1136
 
1177
- // Support: IE 11, Edge
1178
- if ( subWindow.addEventListener ) {
1179
- subWindow.addEventListener( "unload", unloadHandler, false );
1180
-
1181
- // Support: IE 9 - 10 only
1182
- } else if ( subWindow.attachEvent ) {
1183
- subWindow.attachEvent( "onunload", unloadHandler );
1184
- }
1137
+ // Support: IE 9 - 11+, Edge 12 - 18+
1138
+ subWindow.addEventListener( "unload", unloadHandler );
1185
1139
  }
1186
1140
 
1187
- // Support: IE 8 - 11+, Edge 12 - 18+, Chrome <=16 - 25 only, Firefox <=3.6 - 31 only,
1188
- // Safari 4 - 5 only, Opera <=11.6 - 12.x only
1189
- // IE/Edge & older browsers don't support the :scope pseudo-class.
1190
- // Support: Safari 6.0 only
1191
- // Safari 6.0 supports :scope but it's an alias of :root there.
1192
- support.scope = assert( function( el ) {
1193
- docElem.appendChild( el ).appendChild( document.createElement( "div" ) );
1194
- return typeof el.querySelectorAll !== "undefined" &&
1195
- !el.querySelectorAll( ":scope fieldset div" ).length;
1196
- } );
1197
-
1198
- // Support: Chrome 105+, Firefox 104+, Safari 15.4+
1199
- // Make sure forgiving mode is not used in `CSS.supports( "selector(...)" )`.
1200
- //
1201
- // `:is()` uses a forgiving selector list as an argument and is widely
1202
- // implemented, so it's a good one to test against.
1203
- support.cssSupportsSelector = assert( function() {
1204
- /* eslint-disable no-undef */
1205
-
1206
- return CSS.supports( "selector(*)" ) &&
1207
-
1208
- // Support: Firefox 78-81 only
1209
- // In old Firefox, `:is()` didn't use forgiving parsing. In that case,
1210
- // fail this test as there's no selector to test against that.
1211
- // `CSS.supports` uses unforgiving parsing
1212
- document.querySelectorAll( ":is(:jqfake)" ) &&
1213
-
1214
- // `*` is needed as Safari & newer Chrome implemented something in between
1215
- // for `:has()` - it throws in `qSA` if it only contains an unsupported
1216
- // argument but multiple ones, one of which is supported, are fine.
1217
- // We want to play safe in case `:is()` gets the same treatment.
1218
- !CSS.supports( "selector(:is(*,:jqfake))" );
1219
-
1220
- /* eslint-enable */
1141
+ // Support: IE <10
1142
+ // Check if getElementById returns elements by name
1143
+ // The broken getElementById methods don't pick up programmatically-set names,
1144
+ // so use a roundabout getElementsByName test
1145
+ support.getById = assert( function( el ) {
1146
+ documentElement.appendChild( el ).id = jQuery.expando;
1147
+ return !document.getElementsByName ||
1148
+ !document.getElementsByName( jQuery.expando ).length;
1221
1149
  } );
1222
1150
 
1223
- /* Attributes
1224
- ---------------------------------------------------------------------- */
1225
-
1226
- // Support: IE<8
1227
- // Verify that getAttribute really returns attributes and not properties
1228
- // (excepting IE8 booleans)
1229
- support.attributes = assert( function( el ) {
1230
- el.className = "i";
1231
- return !el.getAttribute( "className" );
1151
+ // Support: IE 9 only
1152
+ // Check to see if it's possible to do matchesSelector
1153
+ // on a disconnected node.
1154
+ support.disconnectedMatch = assert( function( el ) {
1155
+ return matches.call( el, "*" );
1232
1156
  } );
1233
1157
 
1234
- /* getElement(s)By*
1235
- ---------------------------------------------------------------------- */
1236
-
1237
- // Check if getElementsByTagName("*") returns only elements
1238
- support.getElementsByTagName = assert( function( el ) {
1239
- el.appendChild( document.createComment( "" ) );
1240
- return !el.getElementsByTagName( "*" ).length;
1158
+ // Support: IE 9 - 11+, Edge 12 - 18+
1159
+ // IE/Edge don't support the :scope pseudo-class.
1160
+ support.scope = assert( function() {
1161
+ return document.querySelectorAll( ":scope" );
1241
1162
  } );
1242
1163
 
1243
- // Support: IE<9
1244
- support.getElementsByClassName = rnative.test( document.getElementsByClassName );
1245
-
1246
- // Support: IE<10
1247
- // Check if getElementById returns elements by name
1248
- // The broken getElementById methods don't pick up programmatically-set names,
1249
- // so use a roundabout getElementsByName test
1250
- support.getById = assert( function( el ) {
1251
- docElem.appendChild( el ).id = expando;
1252
- return !document.getElementsByName || !document.getElementsByName( expando ).length;
1164
+ // Support: Chrome 105 - 111 only, Safari 15.4 - 16.3 only
1165
+ // Make sure the `:has()` argument is parsed unforgivingly.
1166
+ // We include `*` in the test to detect buggy implementations that are
1167
+ // _selectively_ forgiving (specifically when the list includes at least
1168
+ // one valid selector).
1169
+ // Note that we treat complete lack of support for `:has()` as if it were
1170
+ // spec-compliant support, which is fine because use of `:has()` in such
1171
+ // environments will fail in the qSA path and fall back to jQuery traversal
1172
+ // anyway.
1173
+ support.cssHas = assert( function() {
1174
+ try {
1175
+ document.querySelector( ":has(*,:jqfake)" );
1176
+ return false;
1177
+ } catch ( e ) {
1178
+ return true;
1179
+ }
1253
1180
  } );
1254
1181
 
1255
1182
  // ID filter and find
1256
1183
  if ( support.getById ) {
1257
- Expr.filter[ "ID" ] = function( id ) {
1184
+ Expr.filter.ID = function( id ) {
1258
1185
  var attrId = id.replace( runescape, funescape );
1259
1186
  return function( elem ) {
1260
1187
  return elem.getAttribute( "id" ) === attrId;
1261
1188
  };
1262
1189
  };
1263
- Expr.find[ "ID" ] = function( id, context ) {
1190
+ Expr.find.ID = function( id, context ) {
1264
1191
  if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
1265
1192
  var elem = context.getElementById( id );
1266
1193
  return elem ? [ elem ] : [];
1267
1194
  }
1268
1195
  };
1269
1196
  } else {
1270
- Expr.filter[ "ID" ] = function( id ) {
1197
+ Expr.filter.ID = function( id ) {
1271
1198
  var attrId = id.replace( runescape, funescape );
1272
1199
  return function( elem ) {
1273
1200
  var node = typeof elem.getAttributeNode !== "undefined" &&
@@ -1278,7 +1205,7 @@ setDocument = Sizzle.setDocument = function( node ) {
1278
1205
 
1279
1206
  // Support: IE 6 - 7 only
1280
1207
  // getElementById is not reliable as a find shortcut
1281
- Expr.find[ "ID" ] = function( id, context ) {
1208
+ Expr.find.ID = function( id, context ) {
1282
1209
  if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
1283
1210
  var node, i, elems,
1284
1211
  elem = context.getElementById( id );
@@ -1308,40 +1235,18 @@ setDocument = Sizzle.setDocument = function( node ) {
1308
1235
  }
1309
1236
 
1310
1237
  // Tag
1311
- Expr.find[ "TAG" ] = support.getElementsByTagName ?
1312
- function( tag, context ) {
1313
- if ( typeof context.getElementsByTagName !== "undefined" ) {
1314
- return context.getElementsByTagName( tag );
1238
+ Expr.find.TAG = function( tag, context ) {
1239
+ if ( typeof context.getElementsByTagName !== "undefined" ) {
1240
+ return context.getElementsByTagName( tag );
1315
1241
 
1316
- // DocumentFragment nodes don't have gEBTN
1317
- } else if ( support.qsa ) {
1318
- return context.querySelectorAll( tag );
1319
- }
1320
- } :
1321
-
1322
- function( tag, context ) {
1323
- var elem,
1324
- tmp = [],
1325
- i = 0,
1326
-
1327
- // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too
1328
- results = context.getElementsByTagName( tag );
1329
-
1330
- // Filter out possible comments
1331
- if ( tag === "*" ) {
1332
- while ( ( elem = results[ i++ ] ) ) {
1333
- if ( elem.nodeType === 1 ) {
1334
- tmp.push( elem );
1335
- }
1336
- }
1337
-
1338
- return tmp;
1339
- }
1340
- return results;
1341
- };
1242
+ // DocumentFragment nodes don't have gEBTN
1243
+ } else {
1244
+ return context.querySelectorAll( tag );
1245
+ }
1246
+ };
1342
1247
 
1343
1248
  // Class
1344
- Expr.find[ "CLASS" ] = support.getElementsByClassName && function( className, context ) {
1249
+ Expr.find.CLASS = function( className, context ) {
1345
1250
  if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) {
1346
1251
  return context.getElementsByClassName( className );
1347
1252
  }
@@ -1352,195 +1257,94 @@ setDocument = Sizzle.setDocument = function( node ) {
1352
1257
 
1353
1258
  // QSA and matchesSelector support
1354
1259
 
1355
- // matchesSelector(:active) reports false when true (IE9/Opera 11.5)
1356
- rbuggyMatches = [];
1357
-
1358
- // qSa(:focus) reports false when true (Chrome 21)
1359
- // We allow this because of a bug in IE8/9 that throws an error
1360
- // whenever `document.activeElement` is accessed on an iframe
1361
- // So, we allow :focus to pass through QSA all the time to avoid the IE error
1362
- // See https://bugs.jquery.com/ticket/13378
1363
1260
  rbuggyQSA = [];
1364
1261
 
1365
- if ( ( support.qsa = rnative.test( document.querySelectorAll ) ) ) {
1366
-
1367
- // Build QSA regex
1368
- // Regex strategy adopted from Diego Perini
1369
- assert( function( el ) {
1262
+ // Build QSA regex
1263
+ // Regex strategy adopted from Diego Perini
1264
+ assert( function( el ) {
1370
1265
 
1371
- var input;
1372
-
1373
- // Select is set to empty string on purpose
1374
- // This is to test IE's treatment of not explicitly
1375
- // setting a boolean content attribute,
1376
- // since its presence should be enough
1377
- // https://bugs.jquery.com/ticket/12359
1378
- docElem.appendChild( el ).innerHTML = "<a id='" + expando + "'></a>" +
1379
- "<select id='" + expando + "-\r\\' msallowcapture=''>" +
1380
- "<option selected=''></option></select>";
1381
-
1382
- // Support: IE8, Opera 11-12.16
1383
- // Nothing should be selected when empty strings follow ^= or $= or *=
1384
- // The test attribute must be unknown in Opera but "safe" for WinRT
1385
- // https://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section
1386
- if ( el.querySelectorAll( "[msallowcapture^='']" ).length ) {
1387
- rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" );
1388
- }
1389
-
1390
- // Support: IE8
1391
- // Boolean attributes and "value" are not treated correctly
1392
- if ( !el.querySelectorAll( "[selected]" ).length ) {
1393
- rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" );
1394
- }
1395
-
1396
- // Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+
1397
- if ( !el.querySelectorAll( "[id~=" + expando + "-]" ).length ) {
1398
- rbuggyQSA.push( "~=" );
1399
- }
1400
-
1401
- // Support: IE 11+, Edge 15 - 18+
1402
- // IE 11/Edge don't find elements on a `[name='']` query in some cases.
1403
- // Adding a temporary attribute to the document before the selection works
1404
- // around the issue.
1405
- // Interestingly, IE 10 & older don't seem to have the issue.
1406
- input = document.createElement( "input" );
1407
- input.setAttribute( "name", "" );
1408
- el.appendChild( input );
1409
- if ( !el.querySelectorAll( "[name='']" ).length ) {
1410
- rbuggyQSA.push( "\\[" + whitespace + "*name" + whitespace + "*=" +
1411
- whitespace + "*(?:''|\"\")" );
1412
- }
1413
-
1414
- // Webkit/Opera - :checked should return selected option elements
1415
- // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
1416
- // IE8 throws error here and will not see later tests
1417
- if ( !el.querySelectorAll( ":checked" ).length ) {
1418
- rbuggyQSA.push( ":checked" );
1419
- }
1420
-
1421
- // Support: Safari 8+, iOS 8+
1422
- // https://bugs.webkit.org/show_bug.cgi?id=136851
1423
- // In-page `selector#id sibling-combinator selector` fails
1424
- if ( !el.querySelectorAll( "a#" + expando + "+*" ).length ) {
1425
- rbuggyQSA.push( ".#.+[+~]" );
1426
- }
1427
-
1428
- // Support: Firefox <=3.6 - 5 only
1429
- // Old Firefox doesn't throw on a badly-escaped identifier.
1430
- el.querySelectorAll( "\\\f" );
1431
- rbuggyQSA.push( "[\\r\\n\\f]" );
1432
- } );
1266
+ var input;
1433
1267
 
1434
- assert( function( el ) {
1435
- el.innerHTML = "<a href='' disabled='disabled'></a>" +
1436
- "<select disabled='disabled'><option/></select>";
1268
+ documentElement.appendChild( el ).innerHTML =
1269
+ "<a id='" + expando + "' href='' disabled='disabled'></a>" +
1270
+ "<select id='" + expando + "-\r\\' disabled='disabled'>" +
1271
+ "<option selected=''></option></select>";
1437
1272
 
1438
- // Support: Windows 8 Native Apps
1439
- // The type and name attributes are restricted during .innerHTML assignment
1440
- var input = document.createElement( "input" );
1441
- input.setAttribute( "type", "hidden" );
1442
- el.appendChild( input ).setAttribute( "name", "D" );
1443
-
1444
- // Support: IE8
1445
- // Enforce case-sensitivity of name attribute
1446
- if ( el.querySelectorAll( "[name=d]" ).length ) {
1447
- rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" );
1448
- }
1449
-
1450
- // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
1451
- // IE8 throws error here and will not see later tests
1452
- if ( el.querySelectorAll( ":enabled" ).length !== 2 ) {
1453
- rbuggyQSA.push( ":enabled", ":disabled" );
1454
- }
1455
-
1456
- // Support: IE9-11+
1457
- // IE's :disabled selector does not pick up the children of disabled fieldsets
1458
- docElem.appendChild( el ).disabled = true;
1459
- if ( el.querySelectorAll( ":disabled" ).length !== 2 ) {
1460
- rbuggyQSA.push( ":enabled", ":disabled" );
1461
- }
1462
-
1463
- // Support: Opera 10 - 11 only
1464
- // Opera 10-11 does not throw on post-comma invalid pseudos
1465
- el.querySelectorAll( "*,:x" );
1466
- rbuggyQSA.push( ",.*:" );
1467
- } );
1468
- }
1273
+ // Support: iOS <=7 - 8 only
1274
+ // Boolean attributes and "value" are not treated correctly in some XML documents
1275
+ if ( !el.querySelectorAll( "[selected]" ).length ) {
1276
+ rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" );
1277
+ }
1469
1278
 
1470
- if ( ( support.matchesSelector = rnative.test( ( matches = docElem.matches ||
1471
- docElem.webkitMatchesSelector ||
1472
- docElem.mozMatchesSelector ||
1473
- docElem.oMatchesSelector ||
1474
- docElem.msMatchesSelector ) ) ) ) {
1279
+ // Support: iOS <=7 - 8 only
1280
+ if ( !el.querySelectorAll( "[id~=" + expando + "-]" ).length ) {
1281
+ rbuggyQSA.push( "~=" );
1282
+ }
1475
1283
 
1476
- assert( function( el ) {
1284
+ // Support: iOS 8 only
1285
+ // https://bugs.webkit.org/show_bug.cgi?id=136851
1286
+ // In-page `selector#id sibling-combinator selector` fails
1287
+ if ( !el.querySelectorAll( "a#" + expando + "+*" ).length ) {
1288
+ rbuggyQSA.push( ".#.+[+~]" );
1289
+ }
1477
1290
 
1478
- // Check to see if it's possible to do matchesSelector
1479
- // on a disconnected node (IE 9)
1480
- support.disconnectedMatch = matches.call( el, "*" );
1291
+ // Support: Chrome <=105+, Firefox <=104+, Safari <=15.4+
1292
+ // In some of the document kinds, these selectors wouldn't work natively.
1293
+ // This is probably OK but for backwards compatibility we want to maintain
1294
+ // handling them through jQuery traversal in jQuery 3.x.
1295
+ if ( !el.querySelectorAll( ":checked" ).length ) {
1296
+ rbuggyQSA.push( ":checked" );
1297
+ }
1481
1298
 
1482
- // This should fail with an exception
1483
- // Gecko does not error, returns false instead
1484
- matches.call( el, "[s!='']:x" );
1485
- rbuggyMatches.push( "!=", pseudos );
1486
- } );
1487
- }
1299
+ // Support: Windows 8 Native Apps
1300
+ // The type and name attributes are restricted during .innerHTML assignment
1301
+ input = document.createElement( "input" );
1302
+ input.setAttribute( "type", "hidden" );
1303
+ el.appendChild( input ).setAttribute( "name", "D" );
1304
+
1305
+ // Support: IE 9 - 11+
1306
+ // IE's :disabled selector does not pick up the children of disabled fieldsets
1307
+ // Support: Chrome <=105+, Firefox <=104+, Safari <=15.4+
1308
+ // In some of the document kinds, these selectors wouldn't work natively.
1309
+ // This is probably OK but for backwards compatibility we want to maintain
1310
+ // handling them through jQuery traversal in jQuery 3.x.
1311
+ documentElement.appendChild( el ).disabled = true;
1312
+ if ( el.querySelectorAll( ":disabled" ).length !== 2 ) {
1313
+ rbuggyQSA.push( ":enabled", ":disabled" );
1314
+ }
1315
+
1316
+ // Support: IE 11+, Edge 15 - 18+
1317
+ // IE 11/Edge don't find elements on a `[name='']` query in some cases.
1318
+ // Adding a temporary attribute to the document before the selection works
1319
+ // around the issue.
1320
+ // Interestingly, IE 10 & older don't seem to have the issue.
1321
+ input = document.createElement( "input" );
1322
+ input.setAttribute( "name", "" );
1323
+ el.appendChild( input );
1324
+ if ( !el.querySelectorAll( "[name='']" ).length ) {
1325
+ rbuggyQSA.push( "\\[" + whitespace + "*name" + whitespace + "*=" +
1326
+ whitespace + "*(?:''|\"\")" );
1327
+ }
1328
+ } );
1488
1329
 
1489
- if ( !support.cssSupportsSelector ) {
1330
+ if ( !support.cssHas ) {
1490
1331
 
1491
- // Support: Chrome 105+, Safari 15.4+
1492
- // `:has()` uses a forgiving selector list as an argument so our regular
1493
- // `try-catch` mechanism fails to catch `:has()` with arguments not supported
1494
- // natively like `:has(:contains("Foo"))`. Where supported & spec-compliant,
1495
- // we now use `CSS.supports("selector(:is(SELECTOR_TO_BE_TESTED))")`, but
1496
- // outside that we mark `:has` as buggy.
1332
+ // Support: Chrome 105 - 110+, Safari 15.4 - 16.3+
1333
+ // Our regular `try-catch` mechanism fails to detect natively-unsupported
1334
+ // pseudo-classes inside `:has()` (such as `:has(:contains("Foo"))`)
1335
+ // in browsers that parse the `:has()` argument as a forgiving selector list.
1336
+ // https://drafts.csswg.org/selectors/#relational now requires the argument
1337
+ // to be parsed unforgivingly, but browsers have not yet fully adjusted.
1497
1338
  rbuggyQSA.push( ":has" );
1498
1339
  }
1499
1340
 
1500
1341
  rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join( "|" ) );
1501
- rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join( "|" ) );
1502
-
1503
- /* Contains
1504
- ---------------------------------------------------------------------- */
1505
- hasCompare = rnative.test( docElem.compareDocumentPosition );
1506
-
1507
- // Element contains another
1508
- // Purposefully self-exclusive
1509
- // As in, an element does not contain itself
1510
- contains = hasCompare || rnative.test( docElem.contains ) ?
1511
- function( a, b ) {
1512
-
1513
- // Support: IE <9 only
1514
- // IE doesn't have `contains` on `document` so we need to check for
1515
- // `documentElement` presence.
1516
- // We need to fall back to `a` when `documentElement` is missing
1517
- // as `ownerDocument` of elements within `<template/>` may have
1518
- // a null one - a default behavior of all modern browsers.
1519
- var adown = a.nodeType === 9 && a.documentElement || a,
1520
- bup = b && b.parentNode;
1521
- return a === bup || !!( bup && bup.nodeType === 1 && (
1522
- adown.contains ?
1523
- adown.contains( bup ) :
1524
- a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
1525
- ) );
1526
- } :
1527
- function( a, b ) {
1528
- if ( b ) {
1529
- while ( ( b = b.parentNode ) ) {
1530
- if ( b === a ) {
1531
- return true;
1532
- }
1533
- }
1534
- }
1535
- return false;
1536
- };
1537
1342
 
1538
1343
  /* Sorting
1539
1344
  ---------------------------------------------------------------------- */
1540
1345
 
1541
1346
  // Document order sorting
1542
- sortOrder = hasCompare ?
1543
- function( a, b ) {
1347
+ sortOrder = function( a, b ) {
1544
1348
 
1545
1349
  // Flag for duplicate removal
1546
1350
  if ( a === b ) {
@@ -1574,8 +1378,8 @@ setDocument = Sizzle.setDocument = function( node ) {
1574
1378
  // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
1575
1379
  // two documents; shallow comparisons work.
1576
1380
  // eslint-disable-next-line eqeqeq
1577
- if ( a == document || a.ownerDocument == preferredDoc &&
1578
- contains( preferredDoc, a ) ) {
1381
+ if ( a === document || a.ownerDocument == preferredDoc &&
1382
+ find.contains( preferredDoc, a ) ) {
1579
1383
  return -1;
1580
1384
  }
1581
1385
 
@@ -1583,100 +1387,33 @@ setDocument = Sizzle.setDocument = function( node ) {
1583
1387
  // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
1584
1388
  // two documents; shallow comparisons work.
1585
1389
  // eslint-disable-next-line eqeqeq
1586
- if ( b == document || b.ownerDocument == preferredDoc &&
1587
- contains( preferredDoc, b ) ) {
1390
+ if ( b === document || b.ownerDocument == preferredDoc &&
1391
+ find.contains( preferredDoc, b ) ) {
1588
1392
  return 1;
1589
1393
  }
1590
1394
 
1591
1395
  // Maintain original order
1592
1396
  return sortInput ?
1593
- ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
1397
+ ( indexOf.call( sortInput, a ) - indexOf.call( sortInput, b ) ) :
1594
1398
  0;
1595
1399
  }
1596
1400
 
1597
1401
  return compare & 4 ? -1 : 1;
1598
- } :
1599
- function( a, b ) {
1600
-
1601
- // Exit early if the nodes are identical
1602
- if ( a === b ) {
1603
- hasDuplicate = true;
1604
- return 0;
1605
- }
1606
-
1607
- var cur,
1608
- i = 0,
1609
- aup = a.parentNode,
1610
- bup = b.parentNode,
1611
- ap = [ a ],
1612
- bp = [ b ];
1613
-
1614
- // Parentless nodes are either documents or disconnected
1615
- if ( !aup || !bup ) {
1616
-
1617
- // Support: IE 11+, Edge 17 - 18+
1618
- // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
1619
- // two documents; shallow comparisons work.
1620
- /* eslint-disable eqeqeq */
1621
- return a == document ? -1 :
1622
- b == document ? 1 :
1623
- /* eslint-enable eqeqeq */
1624
- aup ? -1 :
1625
- bup ? 1 :
1626
- sortInput ?
1627
- ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
1628
- 0;
1629
-
1630
- // If the nodes are siblings, we can do a quick check
1631
- } else if ( aup === bup ) {
1632
- return siblingCheck( a, b );
1633
- }
1634
-
1635
- // Otherwise we need full lists of their ancestors for comparison
1636
- cur = a;
1637
- while ( ( cur = cur.parentNode ) ) {
1638
- ap.unshift( cur );
1639
- }
1640
- cur = b;
1641
- while ( ( cur = cur.parentNode ) ) {
1642
- bp.unshift( cur );
1643
- }
1644
-
1645
- // Walk down the tree looking for a discrepancy
1646
- while ( ap[ i ] === bp[ i ] ) {
1647
- i++;
1648
- }
1649
-
1650
- return i ?
1651
-
1652
- // Do a sibling check if the nodes have a common ancestor
1653
- siblingCheck( ap[ i ], bp[ i ] ) :
1654
-
1655
- // Otherwise nodes in our document sort first
1656
- // Support: IE 11+, Edge 17 - 18+
1657
- // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
1658
- // two documents; shallow comparisons work.
1659
- /* eslint-disable eqeqeq */
1660
- ap[ i ] == preferredDoc ? -1 :
1661
- bp[ i ] == preferredDoc ? 1 :
1662
- /* eslint-enable eqeqeq */
1663
- 0;
1664
1402
  };
1665
1403
 
1666
1404
  return document;
1667
- };
1405
+ }
1668
1406
 
1669
- Sizzle.matches = function( expr, elements ) {
1670
- return Sizzle( expr, null, null, elements );
1407
+ find.matches = function( expr, elements ) {
1408
+ return find( expr, null, null, elements );
1671
1409
  };
1672
1410
 
1673
- Sizzle.matchesSelector = function( elem, expr ) {
1411
+ find.matchesSelector = function( elem, expr ) {
1674
1412
  setDocument( elem );
1675
1413
 
1676
- if ( support.matchesSelector && documentIsHTML &&
1414
+ if ( documentIsHTML &&
1677
1415
  !nonnativeSelectorCache[ expr + " " ] &&
1678
- ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) &&
1679
- ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) {
1416
+ ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) {
1680
1417
 
1681
1418
  try {
1682
1419
  var ret = matches.call( elem, expr );
@@ -1684,9 +1421,9 @@ Sizzle.matchesSelector = function( elem, expr ) {
1684
1421
  // IE 9's matchesSelector returns false on disconnected nodes
1685
1422
  if ( ret || support.disconnectedMatch ||
1686
1423
 
1687
- // As well, disconnected nodes are said to be in a document
1688
- // fragment in IE 9
1689
- elem.document && elem.document.nodeType !== 11 ) {
1424
+ // As well, disconnected nodes are said to be in a document
1425
+ // fragment in IE 9
1426
+ elem.document && elem.document.nodeType !== 11 ) {
1690
1427
  return ret;
1691
1428
  }
1692
1429
  } catch ( e ) {
@@ -1694,10 +1431,10 @@ Sizzle.matchesSelector = function( elem, expr ) {
1694
1431
  }
1695
1432
  }
1696
1433
 
1697
- return Sizzle( expr, document, null, [ elem ] ).length > 0;
1434
+ return find( expr, document, null, [ elem ] ).length > 0;
1698
1435
  };
1699
1436
 
1700
- Sizzle.contains = function( context, elem ) {
1437
+ find.contains = function( context, elem ) {
1701
1438
 
1702
1439
  // Set document vars if needed
1703
1440
  // Support: IE 11+, Edge 17 - 18+
@@ -1707,10 +1444,11 @@ Sizzle.contains = function( context, elem ) {
1707
1444
  if ( ( context.ownerDocument || context ) != document ) {
1708
1445
  setDocument( context );
1709
1446
  }
1710
- return contains( context, elem );
1447
+ return jQuery.contains( context, elem );
1711
1448
  };
1712
1449
 
1713
- Sizzle.attr = function( elem, name ) {
1450
+
1451
+ find.attr = function( elem, name ) {
1714
1452
 
1715
1453
  // Set document vars if needed
1716
1454
  // Support: IE 11+, Edge 17 - 18+
@@ -1723,25 +1461,19 @@ Sizzle.attr = function( elem, name ) {
1723
1461
 
1724
1462
  var fn = Expr.attrHandle[ name.toLowerCase() ],
1725
1463
 
1726
- // Don't get fooled by Object.prototype properties (jQuery #13807)
1464
+ // Don't get fooled by Object.prototype properties (see trac-13807)
1727
1465
  val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ?
1728
1466
  fn( elem, name, !documentIsHTML ) :
1729
1467
  undefined;
1730
1468
 
1731
- return val !== undefined ?
1732
- val :
1733
- support.attributes || !documentIsHTML ?
1734
- elem.getAttribute( name ) :
1735
- ( val = elem.getAttributeNode( name ) ) && val.specified ?
1736
- val.value :
1737
- null;
1738
- };
1469
+ if ( val !== undefined ) {
1470
+ return val;
1471
+ }
1739
1472
 
1740
- Sizzle.escape = function( sel ) {
1741
- return ( sel + "" ).replace( rcssescape, fcssescape );
1473
+ return elem.getAttribute( name );
1742
1474
  };
1743
1475
 
1744
- Sizzle.error = function( msg ) {
1476
+ find.error = function( msg ) {
1745
1477
  throw new Error( "Syntax error, unrecognized expression: " + msg );
1746
1478
  };
1747
1479
 
@@ -1749,16 +1481,20 @@ Sizzle.error = function( msg ) {
1749
1481
  * Document sorting and removing duplicates
1750
1482
  * @param {ArrayLike} results
1751
1483
  */
1752
- Sizzle.uniqueSort = function( results ) {
1484
+ jQuery.uniqueSort = function( results ) {
1753
1485
  var elem,
1754
1486
  duplicates = [],
1755
1487
  j = 0,
1756
1488
  i = 0;
1757
1489
 
1758
1490
  // Unless we *know* we can detect duplicates, assume their presence
1759
- hasDuplicate = !support.detectDuplicates;
1760
- sortInput = !support.sortStable && results.slice( 0 );
1761
- results.sort( sortOrder );
1491
+ //
1492
+ // Support: Android <=4.0+
1493
+ // Testing for detecting duplicates is unpredictable so instead assume we can't
1494
+ // depend on duplicate detection in all browsers without a stable sort.
1495
+ hasDuplicate = !support.sortStable;
1496
+ sortInput = !support.sortStable && slice.call( results, 0 );
1497
+ sort.call( results, sortOrder );
1762
1498
 
1763
1499
  if ( hasDuplicate ) {
1764
1500
  while ( ( elem = results[ i++ ] ) ) {
@@ -1767,7 +1503,7 @@ Sizzle.uniqueSort = function( results ) {
1767
1503
  }
1768
1504
  }
1769
1505
  while ( j-- ) {
1770
- results.splice( duplicates[ j ], 1 );
1506
+ splice.call( results, duplicates[ j ], 1 );
1771
1507
  }
1772
1508
  }
1773
1509
 
@@ -1778,47 +1514,11 @@ Sizzle.uniqueSort = function( results ) {
1778
1514
  return results;
1779
1515
  };
1780
1516
 
1781
- /**
1782
- * Utility function for retrieving the text value of an array of DOM nodes
1783
- * @param {Array|Element} elem
1784
- */
1785
- getText = Sizzle.getText = function( elem ) {
1786
- var node,
1787
- ret = "",
1788
- i = 0,
1789
- nodeType = elem.nodeType;
1790
-
1791
- if ( !nodeType ) {
1792
-
1793
- // If no nodeType, this is expected to be an array
1794
- while ( ( node = elem[ i++ ] ) ) {
1795
-
1796
- // Do not traverse comment nodes
1797
- ret += getText( node );
1798
- }
1799
- } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
1800
-
1801
- // Use textContent for elements
1802
- // innerText usage removed for consistency of new lines (jQuery #11153)
1803
- if ( typeof elem.textContent === "string" ) {
1804
- return elem.textContent;
1805
- } else {
1806
-
1807
- // Traverse its children
1808
- for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
1809
- ret += getText( elem );
1810
- }
1811
- }
1812
- } else if ( nodeType === 3 || nodeType === 4 ) {
1813
- return elem.nodeValue;
1814
- }
1815
-
1816
- // Do not include comment or processing instruction nodes
1817
-
1818
- return ret;
1517
+ jQuery.fn.uniqueSort = function() {
1518
+ return this.pushStack( jQuery.uniqueSort( slice.apply( this ) ) );
1819
1519
  };
1820
1520
 
1821
- Expr = Sizzle.selectors = {
1521
+ Expr = jQuery.expr = {
1822
1522
 
1823
1523
  // Can be adjusted by the user
1824
1524
  cacheLength: 50,
@@ -1839,12 +1539,12 @@ Expr = Sizzle.selectors = {
1839
1539
  },
1840
1540
 
1841
1541
  preFilter: {
1842
- "ATTR": function( match ) {
1542
+ ATTR: function( match ) {
1843
1543
  match[ 1 ] = match[ 1 ].replace( runescape, funescape );
1844
1544
 
1845
1545
  // Move the given value to match[3] whether quoted or unquoted
1846
- match[ 3 ] = ( match[ 3 ] || match[ 4 ] ||
1847
- match[ 5 ] || "" ).replace( runescape, funescape );
1546
+ match[ 3 ] = ( match[ 3 ] || match[ 4 ] || match[ 5 ] || "" )
1547
+ .replace( runescape, funescape );
1848
1548
 
1849
1549
  if ( match[ 2 ] === "~=" ) {
1850
1550
  match[ 3 ] = " " + match[ 3 ] + " ";
@@ -1853,7 +1553,7 @@ Expr = Sizzle.selectors = {
1853
1553
  return match.slice( 0, 4 );
1854
1554
  },
1855
1555
 
1856
- "CHILD": function( match ) {
1556
+ CHILD: function( match ) {
1857
1557
 
1858
1558
  /* matches from matchExpr["CHILD"]
1859
1559
  1 type (only|nth|...)
@@ -1871,29 +1571,30 @@ Expr = Sizzle.selectors = {
1871
1571
 
1872
1572
  // nth-* requires argument
1873
1573
  if ( !match[ 3 ] ) {
1874
- Sizzle.error( match[ 0 ] );
1574
+ find.error( match[ 0 ] );
1875
1575
  }
1876
1576
 
1877
1577
  // numeric x and y parameters for Expr.filter.CHILD
1878
1578
  // remember that false/true cast respectively to 0/1
1879
1579
  match[ 4 ] = +( match[ 4 ] ?
1880
1580
  match[ 5 ] + ( match[ 6 ] || 1 ) :
1881
- 2 * ( match[ 3 ] === "even" || match[ 3 ] === "odd" ) );
1581
+ 2 * ( match[ 3 ] === "even" || match[ 3 ] === "odd" )
1582
+ );
1882
1583
  match[ 5 ] = +( ( match[ 7 ] + match[ 8 ] ) || match[ 3 ] === "odd" );
1883
1584
 
1884
- // other types prohibit arguments
1585
+ // other types prohibit arguments
1885
1586
  } else if ( match[ 3 ] ) {
1886
- Sizzle.error( match[ 0 ] );
1587
+ find.error( match[ 0 ] );
1887
1588
  }
1888
1589
 
1889
1590
  return match;
1890
1591
  },
1891
1592
 
1892
- "PSEUDO": function( match ) {
1593
+ PSEUDO: function( match ) {
1893
1594
  var excess,
1894
1595
  unquoted = !match[ 6 ] && match[ 2 ];
1895
1596
 
1896
- if ( matchExpr[ "CHILD" ].test( match[ 0 ] ) ) {
1597
+ if ( matchExpr.CHILD.test( match[ 0 ] ) ) {
1897
1598
  return null;
1898
1599
  }
1899
1600
 
@@ -1922,36 +1623,36 @@ Expr = Sizzle.selectors = {
1922
1623
 
1923
1624
  filter: {
1924
1625
 
1925
- "TAG": function( nodeNameSelector ) {
1926
- var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase();
1626
+ TAG: function( nodeNameSelector ) {
1627
+ var expectedNodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase();
1927
1628
  return nodeNameSelector === "*" ?
1928
1629
  function() {
1929
1630
  return true;
1930
1631
  } :
1931
1632
  function( elem ) {
1932
- return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
1633
+ return nodeName( elem, expectedNodeName );
1933
1634
  };
1934
1635
  },
1935
1636
 
1936
- "CLASS": function( className ) {
1637
+ CLASS: function( className ) {
1937
1638
  var pattern = classCache[ className + " " ];
1938
1639
 
1939
1640
  return pattern ||
1940
- ( pattern = new RegExp( "(^|" + whitespace +
1941
- ")" + className + "(" + whitespace + "|$)" ) ) && classCache(
1942
- className, function( elem ) {
1943
- return pattern.test(
1944
- typeof elem.className === "string" && elem.className ||
1945
- typeof elem.getAttribute !== "undefined" &&
1946
- elem.getAttribute( "class" ) ||
1947
- ""
1948
- );
1641
+ ( pattern = new RegExp( "(^|" + whitespace + ")" + className +
1642
+ "(" + whitespace + "|$)" ) ) &&
1643
+ classCache( className, function( elem ) {
1644
+ return pattern.test(
1645
+ typeof elem.className === "string" && elem.className ||
1646
+ typeof elem.getAttribute !== "undefined" &&
1647
+ elem.getAttribute( "class" ) ||
1648
+ ""
1649
+ );
1949
1650
  } );
1950
1651
  },
1951
1652
 
1952
- "ATTR": function( name, operator, check ) {
1653
+ ATTR: function( name, operator, check ) {
1953
1654
  return function( elem ) {
1954
- var result = Sizzle.attr( elem, name );
1655
+ var result = find.attr( elem, name );
1955
1656
 
1956
1657
  if ( result == null ) {
1957
1658
  return operator === "!=";
@@ -1962,22 +1663,34 @@ Expr = Sizzle.selectors = {
1962
1663
 
1963
1664
  result += "";
1964
1665
 
1965
- /* eslint-disable max-len */
1966
-
1967
- return operator === "=" ? result === check :
1968
- operator === "!=" ? result !== check :
1969
- operator === "^=" ? check && result.indexOf( check ) === 0 :
1970
- operator === "*=" ? check && result.indexOf( check ) > -1 :
1971
- operator === "$=" ? check && result.slice( -check.length ) === check :
1972
- operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 :
1973
- operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" :
1974
- false;
1975
- /* eslint-enable max-len */
1666
+ if ( operator === "=" ) {
1667
+ return result === check;
1668
+ }
1669
+ if ( operator === "!=" ) {
1670
+ return result !== check;
1671
+ }
1672
+ if ( operator === "^=" ) {
1673
+ return check && result.indexOf( check ) === 0;
1674
+ }
1675
+ if ( operator === "*=" ) {
1676
+ return check && result.indexOf( check ) > -1;
1677
+ }
1678
+ if ( operator === "$=" ) {
1679
+ return check && result.slice( -check.length ) === check;
1680
+ }
1681
+ if ( operator === "~=" ) {
1682
+ return ( " " + result.replace( rwhitespace, " " ) + " " )
1683
+ .indexOf( check ) > -1;
1684
+ }
1685
+ if ( operator === "|=" ) {
1686
+ return result === check || result.slice( 0, check.length + 1 ) === check + "-";
1687
+ }
1976
1688
 
1689
+ return false;
1977
1690
  };
1978
1691
  },
1979
1692
 
1980
- "CHILD": function( type, what, _argument, first, last ) {
1693
+ CHILD: function( type, what, _argument, first, last ) {
1981
1694
  var simple = type.slice( 0, 3 ) !== "nth",
1982
1695
  forward = type.slice( -4 ) !== "last",
1983
1696
  ofType = what === "of-type";
@@ -1990,7 +1703,7 @@ Expr = Sizzle.selectors = {
1990
1703
  } :
1991
1704
 
1992
1705
  function( elem, _context, xml ) {
1993
- var cache, uniqueCache, outerCache, node, nodeIndex, start,
1706
+ var cache, outerCache, node, nodeIndex, start,
1994
1707
  dir = simple !== forward ? "nextSibling" : "previousSibling",
1995
1708
  parent = elem.parentNode,
1996
1709
  name = ofType && elem.nodeName.toLowerCase(),
@@ -2005,7 +1718,7 @@ Expr = Sizzle.selectors = {
2005
1718
  node = elem;
2006
1719
  while ( ( node = node[ dir ] ) ) {
2007
1720
  if ( ofType ?
2008
- node.nodeName.toLowerCase() === name :
1721
+ nodeName( node, name ) :
2009
1722
  node.nodeType === 1 ) {
2010
1723
 
2011
1724
  return false;
@@ -2024,17 +1737,8 @@ Expr = Sizzle.selectors = {
2024
1737
  if ( forward && useCache ) {
2025
1738
 
2026
1739
  // Seek `elem` from a previously-cached index
2027
-
2028
- // ...in a gzip-friendly way
2029
- node = parent;
2030
- outerCache = node[ expando ] || ( node[ expando ] = {} );
2031
-
2032
- // Support: IE <9 only
2033
- // Defend against cloned attroperties (jQuery gh-1709)
2034
- uniqueCache = outerCache[ node.uniqueID ] ||
2035
- ( outerCache[ node.uniqueID ] = {} );
2036
-
2037
- cache = uniqueCache[ type ] || [];
1740
+ outerCache = parent[ expando ] || ( parent[ expando ] = {} );
1741
+ cache = outerCache[ type ] || [];
2038
1742
  nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
2039
1743
  diff = nodeIndex && cache[ 2 ];
2040
1744
  node = nodeIndex && parent.childNodes[ nodeIndex ];
@@ -2046,7 +1750,7 @@ Expr = Sizzle.selectors = {
2046
1750
 
2047
1751
  // When found, cache indexes on `parent` and break
2048
1752
  if ( node.nodeType === 1 && ++diff && node === elem ) {
2049
- uniqueCache[ type ] = [ dirruns, nodeIndex, diff ];
1753
+ outerCache[ type ] = [ dirruns, nodeIndex, diff ];
2050
1754
  break;
2051
1755
  }
2052
1756
  }
@@ -2055,17 +1759,8 @@ Expr = Sizzle.selectors = {
2055
1759
 
2056
1760
  // Use previously-cached element index if available
2057
1761
  if ( useCache ) {
2058
-
2059
- // ...in a gzip-friendly way
2060
- node = elem;
2061
- outerCache = node[ expando ] || ( node[ expando ] = {} );
2062
-
2063
- // Support: IE <9 only
2064
- // Defend against cloned attroperties (jQuery gh-1709)
2065
- uniqueCache = outerCache[ node.uniqueID ] ||
2066
- ( outerCache[ node.uniqueID ] = {} );
2067
-
2068
- cache = uniqueCache[ type ] || [];
1762
+ outerCache = elem[ expando ] || ( elem[ expando ] = {} );
1763
+ cache = outerCache[ type ] || [];
2069
1764
  nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
2070
1765
  diff = nodeIndex;
2071
1766
  }
@@ -2079,7 +1774,7 @@ Expr = Sizzle.selectors = {
2079
1774
  ( diff = nodeIndex = 0 ) || start.pop() ) ) {
2080
1775
 
2081
1776
  if ( ( ofType ?
2082
- node.nodeName.toLowerCase() === name :
1777
+ nodeName( node, name ) :
2083
1778
  node.nodeType === 1 ) &&
2084
1779
  ++diff ) {
2085
1780
 
@@ -2087,13 +1782,7 @@ Expr = Sizzle.selectors = {
2087
1782
  if ( useCache ) {
2088
1783
  outerCache = node[ expando ] ||
2089
1784
  ( node[ expando ] = {} );
2090
-
2091
- // Support: IE <9 only
2092
- // Defend against cloned attroperties (jQuery gh-1709)
2093
- uniqueCache = outerCache[ node.uniqueID ] ||
2094
- ( outerCache[ node.uniqueID ] = {} );
2095
-
2096
- uniqueCache[ type ] = [ dirruns, diff ];
1785
+ outerCache[ type ] = [ dirruns, diff ];
2097
1786
  }
2098
1787
 
2099
1788
  if ( node === elem ) {
@@ -2111,19 +1800,19 @@ Expr = Sizzle.selectors = {
2111
1800
  };
2112
1801
  },
2113
1802
 
2114
- "PSEUDO": function( pseudo, argument ) {
1803
+ PSEUDO: function( pseudo, argument ) {
2115
1804
 
2116
1805
  // pseudo-class names are case-insensitive
2117
- // http://www.w3.org/TR/selectors/#pseudo-classes
1806
+ // https://www.w3.org/TR/selectors/#pseudo-classes
2118
1807
  // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
2119
1808
  // Remember that setFilters inherits from pseudos
2120
1809
  var args,
2121
1810
  fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||
2122
- Sizzle.error( "unsupported pseudo: " + pseudo );
1811
+ find.error( "unsupported pseudo: " + pseudo );
2123
1812
 
2124
1813
  // The user may use createPseudo to indicate that
2125
1814
  // arguments are needed to create the filter function
2126
- // just as Sizzle does
1815
+ // just as jQuery does
2127
1816
  if ( fn[ expando ] ) {
2128
1817
  return fn( argument );
2129
1818
  }
@@ -2137,7 +1826,7 @@ Expr = Sizzle.selectors = {
2137
1826
  matched = fn( seed, argument ),
2138
1827
  i = matched.length;
2139
1828
  while ( i-- ) {
2140
- idx = indexOf( seed, matched[ i ] );
1829
+ idx = indexOf.call( seed, matched[ i ] );
2141
1830
  seed[ idx ] = !( matches[ idx ] = matched[ i ] );
2142
1831
  }
2143
1832
  } ) :
@@ -2153,14 +1842,14 @@ Expr = Sizzle.selectors = {
2153
1842
  pseudos: {
2154
1843
 
2155
1844
  // Potentially complex pseudos
2156
- "not": markFunction( function( selector ) {
1845
+ not: markFunction( function( selector ) {
2157
1846
 
2158
1847
  // Trim the selector passed to compile
2159
1848
  // to avoid treating leading and trailing
2160
1849
  // spaces as combinators
2161
1850
  var input = [],
2162
1851
  results = [],
2163
- matcher = compile( selector.replace( rtrim, "$1" ) );
1852
+ matcher = compile( selector.replace( rtrimCSS, "$1" ) );
2164
1853
 
2165
1854
  return matcher[ expando ] ?
2166
1855
  markFunction( function( seed, matches, _context, xml ) {
@@ -2179,22 +1868,23 @@ Expr = Sizzle.selectors = {
2179
1868
  input[ 0 ] = elem;
2180
1869
  matcher( input, null, xml, results );
2181
1870
 
2182
- // Don't keep the element (issue #299)
1871
+ // Don't keep the element
1872
+ // (see https://github.com/jquery/sizzle/issues/299)
2183
1873
  input[ 0 ] = null;
2184
1874
  return !results.pop();
2185
1875
  };
2186
1876
  } ),
2187
1877
 
2188
- "has": markFunction( function( selector ) {
1878
+ has: markFunction( function( selector ) {
2189
1879
  return function( elem ) {
2190
- return Sizzle( selector, elem ).length > 0;
1880
+ return find( selector, elem ).length > 0;
2191
1881
  };
2192
1882
  } ),
2193
1883
 
2194
- "contains": markFunction( function( text ) {
1884
+ contains: markFunction( function( text ) {
2195
1885
  text = text.replace( runescape, funescape );
2196
1886
  return function( elem ) {
2197
- return ( elem.textContent || getText( elem ) ).indexOf( text ) > -1;
1887
+ return ( elem.textContent || jQuery.text( elem ) ).indexOf( text ) > -1;
2198
1888
  };
2199
1889
  } ),
2200
1890
 
@@ -2204,12 +1894,12 @@ Expr = Sizzle.selectors = {
2204
1894
  // or beginning with the identifier C immediately followed by "-".
2205
1895
  // The matching of C against the element's language value is performed case-insensitively.
2206
1896
  // The identifier C does not have to be a valid language name."
2207
- // http://www.w3.org/TR/selectors/#lang-pseudo
2208
- "lang": markFunction( function( lang ) {
1897
+ // https://www.w3.org/TR/selectors/#lang-pseudo
1898
+ lang: markFunction( function( lang ) {
2209
1899
 
2210
1900
  // lang value must be a valid identifier
2211
1901
  if ( !ridentifier.test( lang || "" ) ) {
2212
- Sizzle.error( "unsupported lang: " + lang );
1902
+ find.error( "unsupported lang: " + lang );
2213
1903
  }
2214
1904
  lang = lang.replace( runescape, funescape ).toLowerCase();
2215
1905
  return function( elem ) {
@@ -2228,38 +1918,39 @@ Expr = Sizzle.selectors = {
2228
1918
  } ),
2229
1919
 
2230
1920
  // Miscellaneous
2231
- "target": function( elem ) {
1921
+ target: function( elem ) {
2232
1922
  var hash = window.location && window.location.hash;
2233
1923
  return hash && hash.slice( 1 ) === elem.id;
2234
1924
  },
2235
1925
 
2236
- "root": function( elem ) {
2237
- return elem === docElem;
1926
+ root: function( elem ) {
1927
+ return elem === documentElement;
2238
1928
  },
2239
1929
 
2240
- "focus": function( elem ) {
2241
- return elem === document.activeElement &&
2242
- ( !document.hasFocus || document.hasFocus() ) &&
1930
+ focus: function( elem ) {
1931
+ return elem === safeActiveElement() &&
1932
+ document.hasFocus() &&
2243
1933
  !!( elem.type || elem.href || ~elem.tabIndex );
2244
1934
  },
2245
1935
 
2246
1936
  // Boolean properties
2247
- "enabled": createDisabledPseudo( false ),
2248
- "disabled": createDisabledPseudo( true ),
1937
+ enabled: createDisabledPseudo( false ),
1938
+ disabled: createDisabledPseudo( true ),
2249
1939
 
2250
- "checked": function( elem ) {
1940
+ checked: function( elem ) {
2251
1941
 
2252
1942
  // In CSS3, :checked should return both checked and selected elements
2253
- // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
2254
- var nodeName = elem.nodeName.toLowerCase();
2255
- return ( nodeName === "input" && !!elem.checked ) ||
2256
- ( nodeName === "option" && !!elem.selected );
1943
+ // https://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
1944
+ return ( nodeName( elem, "input" ) && !!elem.checked ) ||
1945
+ ( nodeName( elem, "option" ) && !!elem.selected );
2257
1946
  },
2258
1947
 
2259
- "selected": function( elem ) {
1948
+ selected: function( elem ) {
2260
1949
 
2261
- // Accessing this property makes selected-by-default
2262
- // options in Safari work properly
1950
+ // Support: IE <=11+
1951
+ // Accessing the selectedIndex property
1952
+ // forces the browser to treat the default option as
1953
+ // selected when in an optgroup.
2263
1954
  if ( elem.parentNode ) {
2264
1955
  // eslint-disable-next-line no-unused-expressions
2265
1956
  elem.parentNode.selectedIndex;
@@ -2269,9 +1960,9 @@ Expr = Sizzle.selectors = {
2269
1960
  },
2270
1961
 
2271
1962
  // Contents
2272
- "empty": function( elem ) {
1963
+ empty: function( elem ) {
2273
1964
 
2274
- // http://www.w3.org/TR/selectors/#empty-pseudo
1965
+ // https://www.w3.org/TR/selectors/#empty-pseudo
2275
1966
  // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5),
2276
1967
  // but not by others (comment: 8; processing instruction: 7; etc.)
2277
1968
  // nodeType < 6 works because attributes (2) do not appear as children
@@ -2283,49 +1974,49 @@ Expr = Sizzle.selectors = {
2283
1974
  return true;
2284
1975
  },
2285
1976
 
2286
- "parent": function( elem ) {
2287
- return !Expr.pseudos[ "empty" ]( elem );
1977
+ parent: function( elem ) {
1978
+ return !Expr.pseudos.empty( elem );
2288
1979
  },
2289
1980
 
2290
1981
  // Element/input types
2291
- "header": function( elem ) {
1982
+ header: function( elem ) {
2292
1983
  return rheader.test( elem.nodeName );
2293
1984
  },
2294
1985
 
2295
- "input": function( elem ) {
1986
+ input: function( elem ) {
2296
1987
  return rinputs.test( elem.nodeName );
2297
1988
  },
2298
1989
 
2299
- "button": function( elem ) {
2300
- var name = elem.nodeName.toLowerCase();
2301
- return name === "input" && elem.type === "button" || name === "button";
1990
+ button: function( elem ) {
1991
+ return nodeName( elem, "input" ) && elem.type === "button" ||
1992
+ nodeName( elem, "button" );
2302
1993
  },
2303
1994
 
2304
- "text": function( elem ) {
1995
+ text: function( elem ) {
2305
1996
  var attr;
2306
- return elem.nodeName.toLowerCase() === "input" &&
2307
- elem.type === "text" &&
1997
+ return nodeName( elem, "input" ) && elem.type === "text" &&
2308
1998
 
2309
1999
  // Support: IE <10 only
2310
- // New HTML5 attribute values (e.g., "search") appear with elem.type === "text"
2000
+ // New HTML5 attribute values (e.g., "search") appear
2001
+ // with elem.type === "text"
2311
2002
  ( ( attr = elem.getAttribute( "type" ) ) == null ||
2312
2003
  attr.toLowerCase() === "text" );
2313
2004
  },
2314
2005
 
2315
2006
  // Position-in-collection
2316
- "first": createPositionalPseudo( function() {
2007
+ first: createPositionalPseudo( function() {
2317
2008
  return [ 0 ];
2318
2009
  } ),
2319
2010
 
2320
- "last": createPositionalPseudo( function( _matchIndexes, length ) {
2011
+ last: createPositionalPseudo( function( _matchIndexes, length ) {
2321
2012
  return [ length - 1 ];
2322
2013
  } ),
2323
2014
 
2324
- "eq": createPositionalPseudo( function( _matchIndexes, length, argument ) {
2015
+ eq: createPositionalPseudo( function( _matchIndexes, length, argument ) {
2325
2016
  return [ argument < 0 ? argument + length : argument ];
2326
2017
  } ),
2327
2018
 
2328
- "even": createPositionalPseudo( function( matchIndexes, length ) {
2019
+ even: createPositionalPseudo( function( matchIndexes, length ) {
2329
2020
  var i = 0;
2330
2021
  for ( ; i < length; i += 2 ) {
2331
2022
  matchIndexes.push( i );
@@ -2333,7 +2024,7 @@ Expr = Sizzle.selectors = {
2333
2024
  return matchIndexes;
2334
2025
  } ),
2335
2026
 
2336
- "odd": createPositionalPseudo( function( matchIndexes, length ) {
2027
+ odd: createPositionalPseudo( function( matchIndexes, length ) {
2337
2028
  var i = 1;
2338
2029
  for ( ; i < length; i += 2 ) {
2339
2030
  matchIndexes.push( i );
@@ -2341,19 +2032,24 @@ Expr = Sizzle.selectors = {
2341
2032
  return matchIndexes;
2342
2033
  } ),
2343
2034
 
2344
- "lt": createPositionalPseudo( function( matchIndexes, length, argument ) {
2345
- var i = argument < 0 ?
2346
- argument + length :
2347
- argument > length ?
2348
- length :
2349
- argument;
2035
+ lt: createPositionalPseudo( function( matchIndexes, length, argument ) {
2036
+ var i;
2037
+
2038
+ if ( argument < 0 ) {
2039
+ i = argument + length;
2040
+ } else if ( argument > length ) {
2041
+ i = length;
2042
+ } else {
2043
+ i = argument;
2044
+ }
2045
+
2350
2046
  for ( ; --i >= 0; ) {
2351
2047
  matchIndexes.push( i );
2352
2048
  }
2353
2049
  return matchIndexes;
2354
2050
  } ),
2355
2051
 
2356
- "gt": createPositionalPseudo( function( matchIndexes, length, argument ) {
2052
+ gt: createPositionalPseudo( function( matchIndexes, length, argument ) {
2357
2053
  var i = argument < 0 ? argument + length : argument;
2358
2054
  for ( ; ++i < length; ) {
2359
2055
  matchIndexes.push( i );
@@ -2363,7 +2059,7 @@ Expr = Sizzle.selectors = {
2363
2059
  }
2364
2060
  };
2365
2061
 
2366
- Expr.pseudos[ "nth" ] = Expr.pseudos[ "eq" ];
2062
+ Expr.pseudos.nth = Expr.pseudos.eq;
2367
2063
 
2368
2064
  // Add button/input type pseudos
2369
2065
  for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) {
@@ -2378,7 +2074,7 @@ function setFilters() {}
2378
2074
  setFilters.prototype = Expr.filters = Expr.pseudos;
2379
2075
  Expr.setFilters = new setFilters();
2380
2076
 
2381
- tokenize = Sizzle.tokenize = function( selector, parseOnly ) {
2077
+ function tokenize( selector, parseOnly ) {
2382
2078
  var matched, match, tokens, type,
2383
2079
  soFar, groups, preFilters,
2384
2080
  cached = tokenCache[ selector + " " ];
@@ -2406,13 +2102,13 @@ tokenize = Sizzle.tokenize = function( selector, parseOnly ) {
2406
2102
  matched = false;
2407
2103
 
2408
2104
  // Combinators
2409
- if ( ( match = rcombinators.exec( soFar ) ) ) {
2105
+ if ( ( match = rleadingCombinator.exec( soFar ) ) ) {
2410
2106
  matched = match.shift();
2411
2107
  tokens.push( {
2412
2108
  value: matched,
2413
2109
 
2414
2110
  // Cast descendant combinators to space
2415
- type: match[ 0 ].replace( rtrim, " " )
2111
+ type: match[ 0 ].replace( rtrimCSS, " " )
2416
2112
  } );
2417
2113
  soFar = soFar.slice( matched.length );
2418
2114
  }
@@ -2439,14 +2135,16 @@ tokenize = Sizzle.tokenize = function( selector, parseOnly ) {
2439
2135
  // Return the length of the invalid excess
2440
2136
  // if we're just parsing
2441
2137
  // Otherwise, throw an error or return tokens
2442
- return parseOnly ?
2443
- soFar.length :
2444
- soFar ?
2445
- Sizzle.error( selector ) :
2138
+ if ( parseOnly ) {
2139
+ return soFar.length;
2140
+ }
2446
2141
 
2447
- // Cache the tokens
2448
- tokenCache( selector, groups ).slice( 0 );
2449
- };
2142
+ return soFar ?
2143
+ find.error( selector ) :
2144
+
2145
+ // Cache the tokens
2146
+ tokenCache( selector, groups ).slice( 0 );
2147
+ }
2450
2148
 
2451
2149
  function toSelector( tokens ) {
2452
2150
  var i = 0,
@@ -2479,7 +2177,7 @@ function addCombinator( matcher, combinator, base ) {
2479
2177
 
2480
2178
  // Check against all ancestor/preceding elements
2481
2179
  function( elem, context, xml ) {
2482
- var oldCache, uniqueCache, outerCache,
2180
+ var oldCache, outerCache,
2483
2181
  newCache = [ dirruns, doneName ];
2484
2182
 
2485
2183
  // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching
@@ -2496,14 +2194,9 @@ function addCombinator( matcher, combinator, base ) {
2496
2194
  if ( elem.nodeType === 1 || checkNonElements ) {
2497
2195
  outerCache = elem[ expando ] || ( elem[ expando ] = {} );
2498
2196
 
2499
- // Support: IE <9 only
2500
- // Defend against cloned attroperties (jQuery gh-1709)
2501
- uniqueCache = outerCache[ elem.uniqueID ] ||
2502
- ( outerCache[ elem.uniqueID ] = {} );
2503
-
2504
- if ( skip && skip === elem.nodeName.toLowerCase() ) {
2197
+ if ( skip && nodeName( elem, skip ) ) {
2505
2198
  elem = elem[ dir ] || elem;
2506
- } else if ( ( oldCache = uniqueCache[ key ] ) &&
2199
+ } else if ( ( oldCache = outerCache[ key ] ) &&
2507
2200
  oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) {
2508
2201
 
2509
2202
  // Assign to newCache so results back-propagate to previous elements
@@ -2511,7 +2204,7 @@ function addCombinator( matcher, combinator, base ) {
2511
2204
  } else {
2512
2205
 
2513
2206
  // Reuse newcache so results back-propagate to previous elements
2514
- uniqueCache[ key ] = newCache;
2207
+ outerCache[ key ] = newCache;
2515
2208
 
2516
2209
  // A match means we're done; a fail means we have to keep checking
2517
2210
  if ( ( newCache[ 2 ] = matcher( elem, context, xml ) ) ) {
@@ -2543,7 +2236,7 @@ function multipleContexts( selector, contexts, results ) {
2543
2236
  var i = 0,
2544
2237
  len = contexts.length;
2545
2238
  for ( ; i < len; i++ ) {
2546
- Sizzle( selector, contexts[ i ], results );
2239
+ find( selector, contexts[ i ], results );
2547
2240
  }
2548
2241
  return results;
2549
2242
  }
@@ -2577,38 +2270,37 @@ function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postS
2577
2270
  postFinder = setMatcher( postFinder, postSelector );
2578
2271
  }
2579
2272
  return markFunction( function( seed, results, context, xml ) {
2580
- var temp, i, elem,
2273
+ var temp, i, elem, matcherOut,
2581
2274
  preMap = [],
2582
2275
  postMap = [],
2583
2276
  preexisting = results.length,
2584
2277
 
2585
2278
  // Get initial elements from seed or context
2586
- elems = seed || multipleContexts(
2587
- selector || "*",
2588
- context.nodeType ? [ context ] : context,
2589
- []
2590
- ),
2279
+ elems = seed ||
2280
+ multipleContexts( selector || "*",
2281
+ context.nodeType ? [ context ] : context, [] ),
2591
2282
 
2592
2283
  // Prefilter to get matcher input, preserving a map for seed-results synchronization
2593
2284
  matcherIn = preFilter && ( seed || !selector ) ?
2594
2285
  condense( elems, preMap, preFilter, context, xml ) :
2595
- elems,
2286
+ elems;
2596
2287
 
2597
- matcherOut = matcher ?
2288
+ if ( matcher ) {
2598
2289
 
2599
- // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
2600
- postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
2290
+ // If we have a postFinder, or filtered seed, or non-seed postFilter
2291
+ // or preexisting results,
2292
+ matcherOut = postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
2601
2293
 
2602
- // ...intermediate processing is necessary
2603
- [] :
2294
+ // ...intermediate processing is necessary
2295
+ [] :
2604
2296
 
2605
- // ...otherwise use results directly
2606
- results :
2607
- matcherIn;
2297
+ // ...otherwise use results directly
2298
+ results;
2608
2299
 
2609
- // Find primary matches
2610
- if ( matcher ) {
2300
+ // Find primary matches
2611
2301
  matcher( matcherIn, matcherOut, context, xml );
2302
+ } else {
2303
+ matcherOut = matcherIn;
2612
2304
  }
2613
2305
 
2614
2306
  // Apply postFilter
@@ -2646,7 +2338,7 @@ function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postS
2646
2338
  i = matcherOut.length;
2647
2339
  while ( i-- ) {
2648
2340
  if ( ( elem = matcherOut[ i ] ) &&
2649
- ( temp = postFinder ? indexOf( seed, elem ) : preMap[ i ] ) > -1 ) {
2341
+ ( temp = postFinder ? indexOf.call( seed, elem ) : preMap[ i ] ) > -1 ) {
2650
2342
 
2651
2343
  seed[ temp ] = !( results[ temp ] = elem );
2652
2344
  }
@@ -2681,15 +2373,21 @@ function matcherFromTokens( tokens ) {
2681
2373
  return elem === checkContext;
2682
2374
  }, implicitRelative, true ),
2683
2375
  matchAnyContext = addCombinator( function( elem ) {
2684
- return indexOf( checkContext, elem ) > -1;
2376
+ return indexOf.call( checkContext, elem ) > -1;
2685
2377
  }, implicitRelative, true ),
2686
2378
  matchers = [ function( elem, context, xml ) {
2687
- var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || (
2379
+
2380
+ // Support: IE 11+, Edge 17 - 18+
2381
+ // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
2382
+ // two documents; shallow comparisons work.
2383
+ // eslint-disable-next-line eqeqeq
2384
+ var ret = ( !leadingRelative && ( xml || context != outermostContext ) ) || (
2688
2385
  ( checkContext = context ).nodeType ?
2689
2386
  matchContext( elem, context, xml ) :
2690
2387
  matchAnyContext( elem, context, xml ) );
2691
2388
 
2692
- // Avoid hanging onto element (issue #299)
2389
+ // Avoid hanging onto element
2390
+ // (see https://github.com/jquery/sizzle/issues/299)
2693
2391
  checkContext = null;
2694
2392
  return ret;
2695
2393
  } ];
@@ -2714,11 +2412,10 @@ function matcherFromTokens( tokens ) {
2714
2412
  i > 1 && elementMatcher( matchers ),
2715
2413
  i > 1 && toSelector(
2716
2414
 
2717
- // If the preceding token was a descendant combinator, insert an implicit any-element `*`
2718
- tokens
2719
- .slice( 0, i - 1 )
2720
- .concat( { value: tokens[ i - 2 ].type === " " ? "*" : "" } )
2721
- ).replace( rtrim, "$1" ),
2415
+ // If the preceding token was a descendant combinator, insert an implicit any-element `*`
2416
+ tokens.slice( 0, i - 1 )
2417
+ .concat( { value: tokens[ i - 2 ].type === " " ? "*" : "" } )
2418
+ ).replace( rtrimCSS, "$1" ),
2722
2419
  matcher,
2723
2420
  i < j && matcherFromTokens( tokens.slice( i, j ) ),
2724
2421
  j < len && matcherFromTokens( ( tokens = tokens.slice( j ) ) ),
@@ -2744,7 +2441,7 @@ function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
2744
2441
  contextBackup = outermostContext,
2745
2442
 
2746
2443
  // We must always have either seed elements or outermost context
2747
- elems = seed || byElement && Expr.find[ "TAG" ]( "*", outermost ),
2444
+ elems = seed || byElement && Expr.find.TAG( "*", outermost ),
2748
2445
 
2749
2446
  // Use integer dirruns iff this is the outermost matcher
2750
2447
  dirrunsUnique = ( dirruns += contextBackup == null ? 1 : Math.random() || 0.1 ),
@@ -2760,8 +2457,9 @@ function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
2760
2457
  }
2761
2458
 
2762
2459
  // Add elements passing elementMatchers directly to results
2763
- // Support: IE<9, Safari
2764
- // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id
2460
+ // Support: iOS <=7 - 9 only
2461
+ // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching
2462
+ // elements by id. (see trac-14142)
2765
2463
  for ( ; i !== len && ( elem = elems[ i ] ) != null; i++ ) {
2766
2464
  if ( byElement && elem ) {
2767
2465
  j = 0;
@@ -2776,7 +2474,7 @@ function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
2776
2474
  }
2777
2475
  while ( ( matcher = elementMatchers[ j++ ] ) ) {
2778
2476
  if ( matcher( elem, context || document, xml ) ) {
2779
- results.push( elem );
2477
+ push.call( results, elem );
2780
2478
  break;
2781
2479
  }
2782
2480
  }
@@ -2839,7 +2537,7 @@ function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
2839
2537
  if ( outermost && !seed && setMatched.length > 0 &&
2840
2538
  ( matchedCount + setMatchers.length ) > 1 ) {
2841
2539
 
2842
- Sizzle.uniqueSort( results );
2540
+ jQuery.uniqueSort( results );
2843
2541
  }
2844
2542
  }
2845
2543
 
@@ -2857,7 +2555,7 @@ function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
2857
2555
  superMatcher;
2858
2556
  }
2859
2557
 
2860
- compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) {
2558
+ function compile( selector, match /* Internal Use Only */ ) {
2861
2559
  var i,
2862
2560
  setMatchers = [],
2863
2561
  elementMatchers = [],
@@ -2880,27 +2578,25 @@ compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) {
2880
2578
  }
2881
2579
 
2882
2580
  // Cache the compiled function
2883
- cached = compilerCache(
2884
- selector,
2885
- matcherFromGroupMatchers( elementMatchers, setMatchers )
2886
- );
2581
+ cached = compilerCache( selector,
2582
+ matcherFromGroupMatchers( elementMatchers, setMatchers ) );
2887
2583
 
2888
2584
  // Save selector and tokenization
2889
2585
  cached.selector = selector;
2890
2586
  }
2891
2587
  return cached;
2892
- };
2588
+ }
2893
2589
 
2894
2590
  /**
2895
- * A low-level selection function that works with Sizzle's compiled
2591
+ * A low-level selection function that works with jQuery's compiled
2896
2592
  * selector functions
2897
2593
  * @param {String|Function} selector A selector or a pre-compiled
2898
- * selector function built with Sizzle.compile
2594
+ * selector function built with jQuery selector compile
2899
2595
  * @param {Element} context
2900
2596
  * @param {Array} [results]
2901
2597
  * @param {Array} [seed] A set of elements to match against
2902
2598
  */
2903
- select = Sizzle.select = function( selector, context, results, seed ) {
2599
+ function select( selector, context, results, seed ) {
2904
2600
  var i, tokens, token, type, find,
2905
2601
  compiled = typeof selector === "function" && selector,
2906
2602
  match = !seed && tokenize( ( selector = compiled.selector || selector ) );
@@ -2914,10 +2610,12 @@ select = Sizzle.select = function( selector, context, results, seed ) {
2914
2610
  // Reduce context if the leading compound selector is an ID
2915
2611
  tokens = match[ 0 ] = match[ 0 ].slice( 0 );
2916
2612
  if ( tokens.length > 2 && ( token = tokens[ 0 ] ).type === "ID" &&
2917
- context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[ 1 ].type ] ) {
2613
+ context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[ 1 ].type ] ) {
2918
2614
 
2919
- context = ( Expr.find[ "ID" ]( token.matches[ 0 ]
2920
- .replace( runescape, funescape ), context ) || [] )[ 0 ];
2615
+ context = ( Expr.find.ID(
2616
+ token.matches[ 0 ].replace( runescape, funescape ),
2617
+ context
2618
+ ) || [] )[ 0 ];
2921
2619
  if ( !context ) {
2922
2620
  return results;
2923
2621
 
@@ -2930,7 +2628,7 @@ select = Sizzle.select = function( selector, context, results, seed ) {
2930
2628
  }
2931
2629
 
2932
2630
  // Fetch a seed set for right-to-left matching
2933
- i = matchExpr[ "needsContext" ].test( selector ) ? 0 : tokens.length;
2631
+ i = matchExpr.needsContext.test( selector ) ? 0 : tokens.length;
2934
2632
  while ( i-- ) {
2935
2633
  token = tokens[ i ];
2936
2634
 
@@ -2943,8 +2641,8 @@ select = Sizzle.select = function( selector, context, results, seed ) {
2943
2641
  // Search, expanding context for leading sibling combinators
2944
2642
  if ( ( seed = find(
2945
2643
  token.matches[ 0 ].replace( runescape, funescape ),
2946
- rsibling.test( tokens[ 0 ].type ) && testContext( context.parentNode ) ||
2947
- context
2644
+ rsibling.test( tokens[ 0 ].type ) &&
2645
+ testContext( context.parentNode ) || context
2948
2646
  ) ) ) {
2949
2647
 
2950
2648
  // If seed is empty or no tokens remain, we can return early
@@ -2971,21 +2669,18 @@ select = Sizzle.select = function( selector, context, results, seed ) {
2971
2669
  !context || rsibling.test( selector ) && testContext( context.parentNode ) || context
2972
2670
  );
2973
2671
  return results;
2974
- };
2672
+ }
2975
2673
 
2976
2674
  // One-time assignments
2977
2675
 
2676
+ // Support: Android <=4.0 - 4.1+
2978
2677
  // Sort stability
2979
2678
  support.sortStable = expando.split( "" ).sort( sortOrder ).join( "" ) === expando;
2980
2679
 
2981
- // Support: Chrome 14-35+
2982
- // Always assume duplicates if they aren't passed to the comparison function
2983
- support.detectDuplicates = !!hasDuplicate;
2984
-
2985
2680
  // Initialize against the default document
2986
2681
  setDocument();
2987
2682
 
2988
- // Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27)
2683
+ // Support: Android <=4.0 - 4.1+
2989
2684
  // Detached nodes confoundingly follow *each other*
2990
2685
  support.sortDetached = assert( function( el ) {
2991
2686
 
@@ -2993,68 +2688,29 @@ support.sortDetached = assert( function( el ) {
2993
2688
  return el.compareDocumentPosition( document.createElement( "fieldset" ) ) & 1;
2994
2689
  } );
2995
2690
 
2996
- // Support: IE<8
2997
- // Prevent attribute/property "interpolation"
2998
- // https://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
2999
- if ( !assert( function( el ) {
3000
- el.innerHTML = "<a href='#'></a>";
3001
- return el.firstChild.getAttribute( "href" ) === "#";
3002
- } ) ) {
3003
- addHandle( "type|href|height|width", function( elem, name, isXML ) {
3004
- if ( !isXML ) {
3005
- return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 );
3006
- }
3007
- } );
3008
- }
3009
-
3010
- // Support: IE<9
3011
- // Use defaultValue in place of getAttribute("value")
3012
- if ( !support.attributes || !assert( function( el ) {
3013
- el.innerHTML = "<input/>";
3014
- el.firstChild.setAttribute( "value", "" );
3015
- return el.firstChild.getAttribute( "value" ) === "";
3016
- } ) ) {
3017
- addHandle( "value", function( elem, _name, isXML ) {
3018
- if ( !isXML && elem.nodeName.toLowerCase() === "input" ) {
3019
- return elem.defaultValue;
3020
- }
3021
- } );
3022
- }
3023
-
3024
- // Support: IE<9
3025
- // Use getAttributeNode to fetch booleans when getAttribute lies
3026
- if ( !assert( function( el ) {
3027
- return el.getAttribute( "disabled" ) == null;
3028
- } ) ) {
3029
- addHandle( booleans, function( elem, name, isXML ) {
3030
- var val;
3031
- if ( !isXML ) {
3032
- return elem[ name ] === true ? name.toLowerCase() :
3033
- ( val = elem.getAttributeNode( name ) ) && val.specified ?
3034
- val.value :
3035
- null;
3036
- }
3037
- } );
3038
- }
3039
-
3040
- return Sizzle;
3041
-
3042
- } )( window );
3043
-
3044
-
3045
-
3046
- jQuery.find = Sizzle;
3047
- jQuery.expr = Sizzle.selectors;
2691
+ jQuery.find = find;
3048
2692
 
3049
2693
  // Deprecated
3050
2694
  jQuery.expr[ ":" ] = jQuery.expr.pseudos;
3051
- jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort;
3052
- jQuery.text = Sizzle.getText;
3053
- jQuery.isXMLDoc = Sizzle.isXML;
3054
- jQuery.contains = Sizzle.contains;
3055
- jQuery.escapeSelector = Sizzle.escape;
2695
+ jQuery.unique = jQuery.uniqueSort;
2696
+
2697
+ // These have always been private, but they used to be documented
2698
+ // as part of Sizzle so let's maintain them in the 3.x line
2699
+ // for backwards compatibility purposes.
2700
+ find.compile = compile;
2701
+ find.select = select;
2702
+ find.setDocument = setDocument;
3056
2703
 
2704
+ find.escape = jQuery.escapeSelector;
2705
+ find.getText = jQuery.text;
2706
+ find.isXML = jQuery.isXMLDoc;
2707
+ find.selectors = jQuery.expr;
2708
+ find.support = jQuery.support;
2709
+ find.uniqueSort = jQuery.uniqueSort;
3057
2710
 
2711
+ /* eslint-enable */
2712
+
2713
+ } )();
3058
2714
 
3059
2715
 
3060
2716
  var dir = function( elem, dir, until ) {
@@ -3088,13 +2744,6 @@ var siblings = function( n, elem ) {
3088
2744
 
3089
2745
  var rneedsContext = jQuery.expr.match.needsContext;
3090
2746
 
3091
-
3092
-
3093
- function nodeName( elem, name ) {
3094
-
3095
- return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
3096
-
3097
- }
3098
2747
  var rsingleTag = ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i );
3099
2748
 
3100
2749
 
@@ -3345,7 +2994,7 @@ jQuery.fn.extend( {
3345
2994
  if ( cur.nodeType < 11 && ( targets ?
3346
2995
  targets.index( cur ) > -1 :
3347
2996
 
3348
- // Don't pass non-elements to Sizzle
2997
+ // Don't pass non-elements to jQuery#find
3349
2998
  cur.nodeType === 1 &&
3350
2999
  jQuery.find.matchesSelector( cur, selectors ) ) ) {
3351
3000
 
@@ -3900,7 +3549,7 @@ jQuery.extend( {
3900
3549
 
3901
3550
  if ( jQuery.Deferred.exceptionHook ) {
3902
3551
  jQuery.Deferred.exceptionHook( e,
3903
- process.stackTrace );
3552
+ process.error );
3904
3553
  }
3905
3554
 
3906
3555
  // Support: Promises/A+ section 2.3.3.3.4.1
@@ -3928,10 +3577,17 @@ jQuery.extend( {
3928
3577
  process();
3929
3578
  } else {
3930
3579
 
3931
- // Call an optional hook to record the stack, in case of exception
3580
+ // Call an optional hook to record the error, in case of exception
3932
3581
  // since it's otherwise lost when execution goes async
3933
- if ( jQuery.Deferred.getStackHook ) {
3934
- process.stackTrace = jQuery.Deferred.getStackHook();
3582
+ if ( jQuery.Deferred.getErrorHook ) {
3583
+ process.error = jQuery.Deferred.getErrorHook();
3584
+
3585
+ // The deprecated alias of the above. While the name suggests
3586
+ // returning the stack, not an error instance, jQuery just passes
3587
+ // it directly to `console.warn` so both will work; an instance
3588
+ // just better cooperates with source maps.
3589
+ } else if ( jQuery.Deferred.getStackHook ) {
3590
+ process.error = jQuery.Deferred.getStackHook();
3935
3591
  }
3936
3592
  window.setTimeout( process );
3937
3593
  }
@@ -4106,12 +3762,16 @@ jQuery.extend( {
4106
3762
  // warn about them ASAP rather than swallowing them by default.
4107
3763
  var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;
4108
3764
 
4109
- jQuery.Deferred.exceptionHook = function( error, stack ) {
3765
+ // If `jQuery.Deferred.getErrorHook` is defined, `asyncError` is an error
3766
+ // captured before the async barrier to get the original error cause
3767
+ // which may otherwise be hidden.
3768
+ jQuery.Deferred.exceptionHook = function( error, asyncError ) {
4110
3769
 
4111
3770
  // Support: IE 8 - 9 only
4112
3771
  // Console exists when dev tools are open, which can happen at any time
4113
3772
  if ( window.console && window.console.warn && error && rerrorNames.test( error.name ) ) {
4114
- window.console.warn( "jQuery.Deferred exception: " + error.message, error.stack, stack );
3773
+ window.console.warn( "jQuery.Deferred exception: " + error.message,
3774
+ error.stack, asyncError );
4115
3775
  }
4116
3776
  };
4117
3777
 
@@ -5167,25 +4827,6 @@ function returnFalse() {
5167
4827
  return false;
5168
4828
  }
5169
4829
 
5170
- // Support: IE <=9 - 11+
5171
- // focus() and blur() are asynchronous, except when they are no-op.
5172
- // So expect focus to be synchronous when the element is already active,
5173
- // and blur to be synchronous when the element is not already active.
5174
- // (focus and blur are always synchronous in other supported browsers,
5175
- // this just defines when we can count on it).
5176
- function expectSync( elem, type ) {
5177
- return ( elem === safeActiveElement() ) === ( type === "focus" );
5178
- }
5179
-
5180
- // Support: IE <=9 only
5181
- // Accessing document.activeElement can throw unexpectedly
5182
- // https://bugs.jquery.com/ticket/13393
5183
- function safeActiveElement() {
5184
- try {
5185
- return document.activeElement;
5186
- } catch ( err ) { }
5187
- }
5188
-
5189
4830
  function on( elem, types, selector, data, fn, one ) {
5190
4831
  var origFn, type;
5191
4832
 
@@ -5623,7 +5264,7 @@ jQuery.event = {
5623
5264
  el.click && nodeName( el, "input" ) ) {
5624
5265
 
5625
5266
  // dataPriv.set( el, "click", ... )
5626
- leverageNative( el, "click", returnTrue );
5267
+ leverageNative( el, "click", true );
5627
5268
  }
5628
5269
 
5629
5270
  // Return false to allow normal processing in the caller
@@ -5674,10 +5315,10 @@ jQuery.event = {
5674
5315
  // synthetic events by interrupting progress until reinvoked in response to
5675
5316
  // *native* events that it fires directly, ensuring that state changes have
5676
5317
  // already occurred before other listeners are invoked.
5677
- function leverageNative( el, type, expectSync ) {
5318
+ function leverageNative( el, type, isSetup ) {
5678
5319
 
5679
- // Missing expectSync indicates a trigger call, which must force setup through jQuery.event.add
5680
- if ( !expectSync ) {
5320
+ // Missing `isSetup` indicates a trigger call, which must force setup through jQuery.event.add
5321
+ if ( !isSetup ) {
5681
5322
  if ( dataPriv.get( el, type ) === undefined ) {
5682
5323
  jQuery.event.add( el, type, returnTrue );
5683
5324
  }
@@ -5689,15 +5330,13 @@ function leverageNative( el, type, expectSync ) {
5689
5330
  jQuery.event.add( el, type, {
5690
5331
  namespace: false,
5691
5332
  handler: function( event ) {
5692
- var notAsync, result,
5333
+ var result,
5693
5334
  saved = dataPriv.get( this, type );
5694
5335
 
5695
5336
  if ( ( event.isTrigger & 1 ) && this[ type ] ) {
5696
5337
 
5697
5338
  // Interrupt processing of the outer synthetic .trigger()ed event
5698
- // Saved data should be false in such cases, but might be a leftover capture object
5699
- // from an async native handler (gh-4350)
5700
- if ( !saved.length ) {
5339
+ if ( !saved ) {
5701
5340
 
5702
5341
  // Store arguments for use when handling the inner native event
5703
5342
  // There will always be at least one argument (an event object), so this array
@@ -5706,33 +5345,22 @@ function leverageNative( el, type, expectSync ) {
5706
5345
  dataPriv.set( this, type, saved );
5707
5346
 
5708
5347
  // Trigger the native event and capture its result
5709
- // Support: IE <=9 - 11+
5710
- // focus() and blur() are asynchronous
5711
- notAsync = expectSync( this, type );
5712
5348
  this[ type ]();
5713
5349
  result = dataPriv.get( this, type );
5714
- if ( saved !== result || notAsync ) {
5715
- dataPriv.set( this, type, false );
5716
- } else {
5717
- result = {};
5718
- }
5350
+ dataPriv.set( this, type, false );
5351
+
5719
5352
  if ( saved !== result ) {
5720
5353
 
5721
5354
  // Cancel the outer synthetic event
5722
5355
  event.stopImmediatePropagation();
5723
5356
  event.preventDefault();
5724
5357
 
5725
- // Support: Chrome 86+
5726
- // In Chrome, if an element having a focusout handler is blurred by
5727
- // clicking outside of it, it invokes the handler synchronously. If
5728
- // that handler calls `.remove()` on the element, the data is cleared,
5729
- // leaving `result` undefined. We need to guard against this.
5730
- return result && result.value;
5358
+ return result;
5731
5359
  }
5732
5360
 
5733
5361
  // If this is an inner synthetic event for an event with a bubbling surrogate
5734
- // (focus or blur), assume that the surrogate already propagated from triggering the
5735
- // native event and prevent that from happening again here.
5362
+ // (focus or blur), assume that the surrogate already propagated from triggering
5363
+ // the native event and prevent that from happening again here.
5736
5364
  // This technically gets the ordering wrong w.r.t. to `.trigger()` (in which the
5737
5365
  // bubbling surrogate propagates *after* the non-bubbling base), but that seems
5738
5366
  // less bad than duplication.
@@ -5742,22 +5370,25 @@ function leverageNative( el, type, expectSync ) {
5742
5370
 
5743
5371
  // If this is a native event triggered above, everything is now in order
5744
5372
  // Fire an inner synthetic event with the original arguments
5745
- } else if ( saved.length ) {
5373
+ } else if ( saved ) {
5746
5374
 
5747
5375
  // ...and capture the result
5748
- dataPriv.set( this, type, {
5749
- value: jQuery.event.trigger(
5750
-
5751
- // Support: IE <=9 - 11+
5752
- // Extend with the prototype to reset the above stopImmediatePropagation()
5753
- jQuery.extend( saved[ 0 ], jQuery.Event.prototype ),
5754
- saved.slice( 1 ),
5755
- this
5756
- )
5757
- } );
5758
-
5759
- // Abort handling of the native event
5760
- event.stopImmediatePropagation();
5376
+ dataPriv.set( this, type, jQuery.event.trigger(
5377
+ saved[ 0 ],
5378
+ saved.slice( 1 ),
5379
+ this
5380
+ ) );
5381
+
5382
+ // Abort handling of the native event by all jQuery handlers while allowing
5383
+ // native handlers on the same element to run. On target, this is achieved
5384
+ // by stopping immediate propagation just on the jQuery event. However,
5385
+ // the native event is re-wrapped by a jQuery one on each level of the
5386
+ // propagation so the only way to stop it for jQuery is to stop it for
5387
+ // everyone via native `stopPropagation()`. This is not a problem for
5388
+ // focus/blur which don't bubble, but it does also stop click on checkboxes
5389
+ // and radios. We accept this limitation.
5390
+ event.stopPropagation();
5391
+ event.isImmediatePropagationStopped = returnTrue;
5761
5392
  }
5762
5393
  }
5763
5394
  } );
@@ -5896,18 +5527,73 @@ jQuery.each( {
5896
5527
  }, jQuery.event.addProp );
5897
5528
 
5898
5529
  jQuery.each( { focus: "focusin", blur: "focusout" }, function( type, delegateType ) {
5530
+
5531
+ function focusMappedHandler( nativeEvent ) {
5532
+ if ( document.documentMode ) {
5533
+
5534
+ // Support: IE 11+
5535
+ // Attach a single focusin/focusout handler on the document while someone wants
5536
+ // focus/blur. This is because the former are synchronous in IE while the latter
5537
+ // are async. In other browsers, all those handlers are invoked synchronously.
5538
+
5539
+ // `handle` from private data would already wrap the event, but we need
5540
+ // to change the `type` here.
5541
+ var handle = dataPriv.get( this, "handle" ),
5542
+ event = jQuery.event.fix( nativeEvent );
5543
+ event.type = nativeEvent.type === "focusin" ? "focus" : "blur";
5544
+ event.isSimulated = true;
5545
+
5546
+ // First, handle focusin/focusout
5547
+ handle( nativeEvent );
5548
+
5549
+ // ...then, handle focus/blur
5550
+ //
5551
+ // focus/blur don't bubble while focusin/focusout do; simulate the former by only
5552
+ // invoking the handler at the lower level.
5553
+ if ( event.target === event.currentTarget ) {
5554
+
5555
+ // The setup part calls `leverageNative`, which, in turn, calls
5556
+ // `jQuery.event.add`, so event handle will already have been set
5557
+ // by this point.
5558
+ handle( event );
5559
+ }
5560
+ } else {
5561
+
5562
+ // For non-IE browsers, attach a single capturing handler on the document
5563
+ // while someone wants focusin/focusout.
5564
+ jQuery.event.simulate( delegateType, nativeEvent.target,
5565
+ jQuery.event.fix( nativeEvent ) );
5566
+ }
5567
+ }
5568
+
5899
5569
  jQuery.event.special[ type ] = {
5900
5570
 
5901
5571
  // Utilize native event if possible so blur/focus sequence is correct
5902
5572
  setup: function() {
5903
5573
 
5574
+ var attaches;
5575
+
5904
5576
  // Claim the first handler
5905
5577
  // dataPriv.set( this, "focus", ... )
5906
5578
  // dataPriv.set( this, "blur", ... )
5907
- leverageNative( this, type, expectSync );
5579
+ leverageNative( this, type, true );
5908
5580
 
5909
- // Return false to allow normal processing in the caller
5910
- return false;
5581
+ if ( document.documentMode ) {
5582
+
5583
+ // Support: IE 9 - 11+
5584
+ // We use the same native handler for focusin & focus (and focusout & blur)
5585
+ // so we need to coordinate setup & teardown parts between those events.
5586
+ // Use `delegateType` as the key as `type` is already used by `leverageNative`.
5587
+ attaches = dataPriv.get( this, delegateType );
5588
+ if ( !attaches ) {
5589
+ this.addEventListener( delegateType, focusMappedHandler );
5590
+ }
5591
+ dataPriv.set( this, delegateType, ( attaches || 0 ) + 1 );
5592
+ } else {
5593
+
5594
+ // Return false to allow normal processing in the caller
5595
+ return false;
5596
+ }
5911
5597
  },
5912
5598
  trigger: function() {
5913
5599
 
@@ -5918,6 +5604,24 @@ jQuery.each( { focus: "focusin", blur: "focusout" }, function( type, delegateTyp
5918
5604
  return true;
5919
5605
  },
5920
5606
 
5607
+ teardown: function() {
5608
+ var attaches;
5609
+
5610
+ if ( document.documentMode ) {
5611
+ attaches = dataPriv.get( this, delegateType ) - 1;
5612
+ if ( !attaches ) {
5613
+ this.removeEventListener( delegateType, focusMappedHandler );
5614
+ dataPriv.remove( this, delegateType );
5615
+ } else {
5616
+ dataPriv.set( this, delegateType, attaches );
5617
+ }
5618
+ } else {
5619
+
5620
+ // Return false to indicate standard teardown should be applied
5621
+ return false;
5622
+ }
5623
+ },
5624
+
5921
5625
  // Suppress native focus or blur if we're currently inside
5922
5626
  // a leveraged native-event stack
5923
5627
  _default: function( event ) {
@@ -5926,6 +5630,58 @@ jQuery.each( { focus: "focusin", blur: "focusout" }, function( type, delegateTyp
5926
5630
 
5927
5631
  delegateType: delegateType
5928
5632
  };
5633
+
5634
+ // Support: Firefox <=44
5635
+ // Firefox doesn't have focus(in | out) events
5636
+ // Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787
5637
+ //
5638
+ // Support: Chrome <=48 - 49, Safari <=9.0 - 9.1
5639
+ // focus(in | out) events fire after focus & blur events,
5640
+ // which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order
5641
+ // Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857
5642
+ //
5643
+ // Support: IE 9 - 11+
5644
+ // To preserve relative focusin/focus & focusout/blur event order guaranteed on the 3.x branch,
5645
+ // attach a single handler for both events in IE.
5646
+ jQuery.event.special[ delegateType ] = {
5647
+ setup: function() {
5648
+
5649
+ // Handle: regular nodes (via `this.ownerDocument`), window
5650
+ // (via `this.document`) & document (via `this`).
5651
+ var doc = this.ownerDocument || this.document || this,
5652
+ dataHolder = document.documentMode ? this : doc,
5653
+ attaches = dataPriv.get( dataHolder, delegateType );
5654
+
5655
+ // Support: IE 9 - 11+
5656
+ // We use the same native handler for focusin & focus (and focusout & blur)
5657
+ // so we need to coordinate setup & teardown parts between those events.
5658
+ // Use `delegateType` as the key as `type` is already used by `leverageNative`.
5659
+ if ( !attaches ) {
5660
+ if ( document.documentMode ) {
5661
+ this.addEventListener( delegateType, focusMappedHandler );
5662
+ } else {
5663
+ doc.addEventListener( type, focusMappedHandler, true );
5664
+ }
5665
+ }
5666
+ dataPriv.set( dataHolder, delegateType, ( attaches || 0 ) + 1 );
5667
+ },
5668
+ teardown: function() {
5669
+ var doc = this.ownerDocument || this.document || this,
5670
+ dataHolder = document.documentMode ? this : doc,
5671
+ attaches = dataPriv.get( dataHolder, delegateType ) - 1;
5672
+
5673
+ if ( !attaches ) {
5674
+ if ( document.documentMode ) {
5675
+ this.removeEventListener( delegateType, focusMappedHandler );
5676
+ } else {
5677
+ doc.removeEventListener( type, focusMappedHandler, true );
5678
+ }
5679
+ dataPriv.remove( dataHolder, delegateType );
5680
+ } else {
5681
+ dataPriv.set( dataHolder, delegateType, attaches );
5682
+ }
5683
+ }
5684
+ };
5929
5685
  } );
5930
5686
 
5931
5687
  // Create mouseenter/leave events using mouseover/out and event-time checks
@@ -6228,7 +5984,8 @@ jQuery.extend( {
6228
5984
  if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) &&
6229
5985
  !jQuery.isXMLDoc( elem ) ) {
6230
5986
 
6231
- // We eschew Sizzle here for performance reasons: https://jsperf.com/getall-vs-sizzle/2
5987
+ // We eschew jQuery#find here for performance reasons:
5988
+ // https://jsperf.com/getall-vs-sizzle/2
6232
5989
  destElements = getAll( clone );
6233
5990
  srcElements = getAll( elem );
6234
5991
 
@@ -6504,15 +6261,6 @@ var swap = function( elem, options, callback ) {
6504
6261
 
6505
6262
  var rboxStyle = new RegExp( cssExpand.join( "|" ), "i" );
6506
6263
 
6507
- var whitespace = "[\\x20\\t\\r\\n\\f]";
6508
-
6509
-
6510
- var rtrimCSS = new RegExp(
6511
- "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$",
6512
- "g"
6513
- );
6514
-
6515
-
6516
6264
 
6517
6265
 
6518
6266
  ( function() {
@@ -6821,7 +6569,8 @@ function setPositiveNumber( _elem, value, subtract ) {
6821
6569
  function boxModelAdjustment( elem, dimension, box, isBorderBox, styles, computedVal ) {
6822
6570
  var i = dimension === "width" ? 1 : 0,
6823
6571
  extra = 0,
6824
- delta = 0;
6572
+ delta = 0,
6573
+ marginDelta = 0;
6825
6574
 
6826
6575
  // Adjustment may not be necessary
6827
6576
  if ( box === ( isBorderBox ? "border" : "content" ) ) {
@@ -6831,8 +6580,10 @@ function boxModelAdjustment( elem, dimension, box, isBorderBox, styles, computed
6831
6580
  for ( ; i < 4; i += 2 ) {
6832
6581
 
6833
6582
  // Both box models exclude margin
6583
+ // Count margin delta separately to only add it after scroll gutter adjustment.
6584
+ // This is needed to make negative margins work with `outerHeight( true )` (gh-3982).
6834
6585
  if ( box === "margin" ) {
6835
- delta += jQuery.css( elem, box + cssExpand[ i ], true, styles );
6586
+ marginDelta += jQuery.css( elem, box + cssExpand[ i ], true, styles );
6836
6587
  }
6837
6588
 
6838
6589
  // If we get here with a content-box, we're seeking "padding" or "border" or "margin"
@@ -6883,7 +6634,7 @@ function boxModelAdjustment( elem, dimension, box, isBorderBox, styles, computed
6883
6634
  ) ) || 0;
6884
6635
  }
6885
6636
 
6886
- return delta;
6637
+ return delta + marginDelta;
6887
6638
  }
6888
6639
 
6889
6640
  function getWidthOrHeight( elem, dimension, extra ) {
@@ -6981,26 +6732,35 @@ jQuery.extend( {
6981
6732
 
6982
6733
  // Don't automatically add "px" to these possibly-unitless properties
6983
6734
  cssNumber: {
6984
- "animationIterationCount": true,
6985
- "columnCount": true,
6986
- "fillOpacity": true,
6987
- "flexGrow": true,
6988
- "flexShrink": true,
6989
- "fontWeight": true,
6990
- "gridArea": true,
6991
- "gridColumn": true,
6992
- "gridColumnEnd": true,
6993
- "gridColumnStart": true,
6994
- "gridRow": true,
6995
- "gridRowEnd": true,
6996
- "gridRowStart": true,
6997
- "lineHeight": true,
6998
- "opacity": true,
6999
- "order": true,
7000
- "orphans": true,
7001
- "widows": true,
7002
- "zIndex": true,
7003
- "zoom": true
6735
+ animationIterationCount: true,
6736
+ aspectRatio: true,
6737
+ borderImageSlice: true,
6738
+ columnCount: true,
6739
+ flexGrow: true,
6740
+ flexShrink: true,
6741
+ fontWeight: true,
6742
+ gridArea: true,
6743
+ gridColumn: true,
6744
+ gridColumnEnd: true,
6745
+ gridColumnStart: true,
6746
+ gridRow: true,
6747
+ gridRowEnd: true,
6748
+ gridRowStart: true,
6749
+ lineHeight: true,
6750
+ opacity: true,
6751
+ order: true,
6752
+ orphans: true,
6753
+ scale: true,
6754
+ widows: true,
6755
+ zIndex: true,
6756
+ zoom: true,
6757
+
6758
+ // SVG-related
6759
+ fillOpacity: true,
6760
+ floodOpacity: true,
6761
+ stopOpacity: true,
6762
+ strokeMiterlimit: true,
6763
+ strokeOpacity: true
7004
6764
  },
7005
6765
 
7006
6766
  // Add in properties whose names you wish to fix before
@@ -8726,9 +8486,39 @@ jQuery.each( [ "radio", "checkbox" ], function() {
8726
8486
 
8727
8487
 
8728
8488
  // Return jQuery for attributes-only inclusion
8489
+ var location = window.location;
8490
+
8491
+ var nonce = { guid: Date.now() };
8729
8492
 
8493
+ var rquery = ( /\?/ );
8730
8494
 
8731
- support.focusin = "onfocusin" in window;
8495
+
8496
+
8497
+ // Cross-browser xml parsing
8498
+ jQuery.parseXML = function( data ) {
8499
+ var xml, parserErrorElem;
8500
+ if ( !data || typeof data !== "string" ) {
8501
+ return null;
8502
+ }
8503
+
8504
+ // Support: IE 9 - 11 only
8505
+ // IE throws on parseFromString with invalid input.
8506
+ try {
8507
+ xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" );
8508
+ } catch ( e ) {}
8509
+
8510
+ parserErrorElem = xml && xml.getElementsByTagName( "parsererror" )[ 0 ];
8511
+ if ( !xml || parserErrorElem ) {
8512
+ jQuery.error( "Invalid XML: " + (
8513
+ parserErrorElem ?
8514
+ jQuery.map( parserErrorElem.childNodes, function( el ) {
8515
+ return el.textContent;
8516
+ } ).join( "\n" ) :
8517
+ data
8518
+ ) );
8519
+ }
8520
+ return xml;
8521
+ };
8732
8522
 
8733
8523
 
8734
8524
  var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
@@ -8916,85 +8706,6 @@ jQuery.fn.extend( {
8916
8706
  } );
8917
8707
 
8918
8708
 
8919
- // Support: Firefox <=44
8920
- // Firefox doesn't have focus(in | out) events
8921
- // Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787
8922
- //
8923
- // Support: Chrome <=48 - 49, Safari <=9.0 - 9.1
8924
- // focus(in | out) events fire after focus & blur events,
8925
- // which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order
8926
- // Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857
8927
- if ( !support.focusin ) {
8928
- jQuery.each( { focus: "focusin", blur: "focusout" }, function( orig, fix ) {
8929
-
8930
- // Attach a single capturing handler on the document while someone wants focusin/focusout
8931
- var handler = function( event ) {
8932
- jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ) );
8933
- };
8934
-
8935
- jQuery.event.special[ fix ] = {
8936
- setup: function() {
8937
-
8938
- // Handle: regular nodes (via `this.ownerDocument`), window
8939
- // (via `this.document`) & document (via `this`).
8940
- var doc = this.ownerDocument || this.document || this,
8941
- attaches = dataPriv.access( doc, fix );
8942
-
8943
- if ( !attaches ) {
8944
- doc.addEventListener( orig, handler, true );
8945
- }
8946
- dataPriv.access( doc, fix, ( attaches || 0 ) + 1 );
8947
- },
8948
- teardown: function() {
8949
- var doc = this.ownerDocument || this.document || this,
8950
- attaches = dataPriv.access( doc, fix ) - 1;
8951
-
8952
- if ( !attaches ) {
8953
- doc.removeEventListener( orig, handler, true );
8954
- dataPriv.remove( doc, fix );
8955
-
8956
- } else {
8957
- dataPriv.access( doc, fix, attaches );
8958
- }
8959
- }
8960
- };
8961
- } );
8962
- }
8963
- var location = window.location;
8964
-
8965
- var nonce = { guid: Date.now() };
8966
-
8967
- var rquery = ( /\?/ );
8968
-
8969
-
8970
-
8971
- // Cross-browser xml parsing
8972
- jQuery.parseXML = function( data ) {
8973
- var xml, parserErrorElem;
8974
- if ( !data || typeof data !== "string" ) {
8975
- return null;
8976
- }
8977
-
8978
- // Support: IE 9 - 11 only
8979
- // IE throws on parseFromString with invalid input.
8980
- try {
8981
- xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" );
8982
- } catch ( e ) {}
8983
-
8984
- parserErrorElem = xml && xml.getElementsByTagName( "parsererror" )[ 0 ];
8985
- if ( !xml || parserErrorElem ) {
8986
- jQuery.error( "Invalid XML: " + (
8987
- parserErrorElem ?
8988
- jQuery.map( parserErrorElem.childNodes, function( el ) {
8989
- return el.textContent;
8990
- } ).join( "\n" ) :
8991
- data
8992
- ) );
8993
- }
8994
- return xml;
8995
- };
8996
-
8997
-
8998
8709
  var
8999
8710
  rbracket = /\[\]$/,
9000
8711
  rCRLF = /\r?\n/g,