jquery-rails 4.3.4 → 4.4.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * jQuery JavaScript Library v3.4.0
2
+ * jQuery JavaScript Library v3.5.1
3
3
  * https://jquery.com/
4
4
  *
5
5
  * Includes Sizzle.js
@@ -9,7 +9,7 @@
9
9
  * Released under the MIT license
10
10
  * https://jquery.org/license
11
11
  *
12
- * Date: 2019-04-10T19:48Z
12
+ * Date: 2020-05-04T22:49Z
13
13
  */
14
14
  ( function( global, factory ) {
15
15
 
@@ -47,13 +47,16 @@
47
47
 
48
48
  var arr = [];
49
49
 
50
- var document = window.document;
51
-
52
50
  var getProto = Object.getPrototypeOf;
53
51
 
54
52
  var slice = arr.slice;
55
53
 
56
- var concat = arr.concat;
54
+ var flat = arr.flat ? function( array ) {
55
+ return arr.flat.call( array );
56
+ } : function( array ) {
57
+ return arr.concat.apply( [], array );
58
+ };
59
+
57
60
 
58
61
  var push = arr.push;
59
62
 
@@ -86,6 +89,8 @@ var isWindow = function isWindow( obj ) {
86
89
  };
87
90
 
88
91
 
92
+ var document = window.document;
93
+
89
94
 
90
95
 
91
96
  var preservedScriptAttributes = {
@@ -142,7 +147,7 @@ function toType( obj ) {
142
147
 
143
148
 
144
149
  var
145
- version = "3.4.0",
150
+ version = "3.5.1",
146
151
 
147
152
  // Define a local copy of jQuery
148
153
  jQuery = function( selector, context ) {
@@ -150,11 +155,7 @@ var
150
155
  // The jQuery object is actually just the init constructor 'enhanced'
151
156
  // Need init if jQuery is called (just allow error to be thrown if not included)
152
157
  return new jQuery.fn.init( selector, context );
153
- },
154
-
155
- // Support: Android <=4.0 only
156
- // Make sure we trim BOM and NBSP
157
- rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;
158
+ };
158
159
 
159
160
  jQuery.fn = jQuery.prototype = {
160
161
 
@@ -220,6 +221,18 @@ jQuery.fn = jQuery.prototype = {
220
221
  return this.eq( -1 );
221
222
  },
222
223
 
224
+ even: function() {
225
+ return this.pushStack( jQuery.grep( this, function( _elem, i ) {
226
+ return ( i + 1 ) % 2;
227
+ } ) );
228
+ },
229
+
230
+ odd: function() {
231
+ return this.pushStack( jQuery.grep( this, function( _elem, i ) {
232
+ return i % 2;
233
+ } ) );
234
+ },
235
+
223
236
  eq: function( i ) {
224
237
  var len = this.length,
225
238
  j = +i + ( i < 0 ? len : 0 );
@@ -353,9 +366,10 @@ jQuery.extend( {
353
366
  return true;
354
367
  },
355
368
 
356
- // Evaluates a script in a global context
357
- globalEval: function( code, options ) {
358
- DOMEval( code, { nonce: options && options.nonce } );
369
+ // Evaluates a script in a provided context; falls back to the global one
370
+ // if not specified.
371
+ globalEval: function( code, options, doc ) {
372
+ DOMEval( code, { nonce: options && options.nonce }, doc );
359
373
  },
360
374
 
361
375
  each: function( obj, callback ) {
@@ -379,13 +393,6 @@ jQuery.extend( {
379
393
  return obj;
380
394
  },
381
395
 
382
- // Support: Android <=4.0 only
383
- trim: function( text ) {
384
- return text == null ?
385
- "" :
386
- ( text + "" ).replace( rtrim, "" );
387
- },
388
-
389
396
  // results is for internal usage only
390
397
  makeArray: function( arr, results ) {
391
398
  var ret = results || [];
@@ -472,7 +479,7 @@ jQuery.extend( {
472
479
  }
473
480
 
474
481
  // Flatten any nested arrays
475
- return concat.apply( [], ret );
482
+ return flat( ret );
476
483
  },
477
484
 
478
485
  // A global GUID counter for objects
@@ -489,7 +496,7 @@ if ( typeof Symbol === "function" ) {
489
496
 
490
497
  // Populate the class2type map
491
498
  jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ),
492
- function( i, name ) {
499
+ function( _i, name ) {
493
500
  class2type[ "[object " + name + "]" ] = name.toLowerCase();
494
501
  } );
495
502
 
@@ -511,17 +518,16 @@ function isArrayLike( obj ) {
511
518
  }
512
519
  var Sizzle =
513
520
  /*!
514
- * Sizzle CSS Selector Engine v2.3.4
521
+ * Sizzle CSS Selector Engine v2.3.5
515
522
  * https://sizzlejs.com/
516
523
  *
517
524
  * Copyright JS Foundation and other contributors
518
525
  * Released under the MIT license
519
526
  * https://js.foundation/
520
527
  *
521
- * Date: 2019-04-08
528
+ * Date: 2020-03-14
522
529
  */
523
- (function( window ) {
524
-
530
+ ( function( window ) {
525
531
  var i,
526
532
  support,
527
533
  Expr,
@@ -561,59 +567,70 @@ var i,
561
567
  },
562
568
 
563
569
  // Instance methods
564
- hasOwn = ({}).hasOwnProperty,
570
+ hasOwn = ( {} ).hasOwnProperty,
565
571
  arr = [],
566
572
  pop = arr.pop,
567
- push_native = arr.push,
573
+ pushNative = arr.push,
568
574
  push = arr.push,
569
575
  slice = arr.slice,
576
+
570
577
  // Use a stripped-down indexOf as it's faster than native
571
578
  // https://jsperf.com/thor-indexof-vs-for/5
572
579
  indexOf = function( list, elem ) {
573
580
  var i = 0,
574
581
  len = list.length;
575
582
  for ( ; i < len; i++ ) {
576
- if ( list[i] === elem ) {
583
+ if ( list[ i ] === elem ) {
577
584
  return i;
578
585
  }
579
586
  }
580
587
  return -1;
581
588
  },
582
589
 
583
- booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",
590
+ booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|" +
591
+ "ismap|loop|multiple|open|readonly|required|scoped",
584
592
 
585
593
  // Regular expressions
586
594
 
587
595
  // http://www.w3.org/TR/css3-selectors/#whitespace
588
596
  whitespace = "[\\x20\\t\\r\\n\\f]",
589
597
 
590
- // http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
591
- identifier = "(?:\\\\.|[\\w-]|[^\0-\\xa0])+",
598
+ // https://www.w3.org/TR/css-syntax-3/#ident-token-diagram
599
+ identifier = "(?:\\\\[\\da-fA-F]{1,6}" + whitespace +
600
+ "?|\\\\[^\\r\\n\\f]|[\\w-]|[^\0-\\x7f])+",
592
601
 
593
602
  // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors
594
603
  attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace +
604
+
595
605
  // Operator (capture 2)
596
606
  "*([*^$|!~]?=)" + whitespace +
597
- // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]"
598
- "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace +
599
- "*\\]",
607
+
608
+ // "Attribute values must be CSS identifiers [capture 5]
609
+ // or strings [capture 3 or capture 4]"
610
+ "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" +
611
+ whitespace + "*\\]",
600
612
 
601
613
  pseudos = ":(" + identifier + ")(?:\\((" +
614
+
602
615
  // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments:
603
616
  // 1. quoted (capture 3; capture 4 or capture 5)
604
617
  "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" +
618
+
605
619
  // 2. simple (capture 6)
606
620
  "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" +
621
+
607
622
  // 3. anything else (capture 2)
608
623
  ".*" +
609
624
  ")\\)|)",
610
625
 
611
626
  // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
612
627
  rwhitespace = new RegExp( whitespace + "+", "g" ),
613
- rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ),
628
+ rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" +
629
+ whitespace + "+$", "g" ),
614
630
 
615
631
  rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
616
- rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ),
632
+ rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace +
633
+ "*" ),
617
634
  rdescend = new RegExp( whitespace + "|>" ),
618
635
 
619
636
  rpseudo = new RegExp( pseudos ),
@@ -625,14 +642,16 @@ var i,
625
642
  "TAG": new RegExp( "^(" + identifier + "|[*])" ),
626
643
  "ATTR": new RegExp( "^" + attributes ),
627
644
  "PSEUDO": new RegExp( "^" + pseudos ),
628
- "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace +
629
- "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace +
630
- "*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
645
+ "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" +
646
+ whitespace + "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" +
647
+ whitespace + "*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
631
648
  "bool": new RegExp( "^(?:" + booleans + ")$", "i" ),
649
+
632
650
  // For use in libraries implementing .is()
633
651
  // We use this for POS matching in `select`
634
- "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" +
635
- whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )
652
+ "needsContext": new RegExp( "^" + whitespace +
653
+ "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + whitespace +
654
+ "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )
636
655
  },
637
656
 
638
657
  rhtml = /HTML$/i,
@@ -648,18 +667,21 @@ var i,
648
667
 
649
668
  // CSS escapes
650
669
  // http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
651
- runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ),
652
- funescape = function( _, escaped, escapedWhitespace ) {
653
- var high = "0x" + escaped - 0x10000;
654
- // NaN means non-codepoint
655
- // Support: Firefox<24
656
- // Workaround erroneous numeric interpretation of +"0x"
657
- return high !== high || escapedWhitespace ?
658
- escaped :
670
+ runescape = new RegExp( "\\\\[\\da-fA-F]{1,6}" + whitespace + "?|\\\\([^\\r\\n\\f])", "g" ),
671
+ funescape = function( escape, nonHex ) {
672
+ var high = "0x" + escape.slice( 1 ) - 0x10000;
673
+
674
+ return nonHex ?
675
+
676
+ // Strip the backslash prefix from a non-hex escape sequence
677
+ nonHex :
678
+
679
+ // Replace a hexadecimal escape sequence with the encoded Unicode code point
680
+ // Support: IE <=11+
681
+ // For values outside the Basic Multilingual Plane (BMP), manually construct a
682
+ // surrogate pair
659
683
  high < 0 ?
660
- // BMP codepoint
661
684
  String.fromCharCode( high + 0x10000 ) :
662
- // Supplemental Plane codepoint (surrogate pair)
663
685
  String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
664
686
  },
665
687
 
@@ -675,7 +697,8 @@ var i,
675
697
  }
676
698
 
677
699
  // Control characters and (dependent upon position) numbers get escaped as code points
678
- return ch.slice( 0, -1 ) + "\\" + ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " ";
700
+ return ch.slice( 0, -1 ) + "\\" +
701
+ ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " ";
679
702
  }
680
703
 
681
704
  // Other potentially-special ASCII characters get backslash-escaped
@@ -700,18 +723,20 @@ var i,
700
723
  // Optimize for push.apply( _, NodeList )
701
724
  try {
702
725
  push.apply(
703
- (arr = slice.call( preferredDoc.childNodes )),
726
+ ( arr = slice.call( preferredDoc.childNodes ) ),
704
727
  preferredDoc.childNodes
705
728
  );
729
+
706
730
  // Support: Android<4.0
707
731
  // Detect silently failing push.apply
732
+ // eslint-disable-next-line no-unused-expressions
708
733
  arr[ preferredDoc.childNodes.length ].nodeType;
709
734
  } catch ( e ) {
710
735
  push = { apply: arr.length ?
711
736
 
712
737
  // Leverage slice if possible
713
738
  function( target, els ) {
714
- push_native.apply( target, slice.call(els) );
739
+ pushNative.apply( target, slice.call( els ) );
715
740
  } :
716
741
 
717
742
  // Support: IE<9
@@ -719,8 +744,9 @@ try {
719
744
  function( target, els ) {
720
745
  var j = target.length,
721
746
  i = 0;
747
+
722
748
  // Can't trust NodeList.length
723
- while ( (target[j++] = els[i++]) ) {}
749
+ while ( ( target[ j++ ] = els[ i++ ] ) ) {}
724
750
  target.length = j - 1;
725
751
  }
726
752
  };
@@ -744,24 +770,21 @@ function Sizzle( selector, context, results, seed ) {
744
770
 
745
771
  // Try to shortcut find operations (as opposed to filters) in HTML documents
746
772
  if ( !seed ) {
747
-
748
- if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) {
749
- setDocument( context );
750
- }
773
+ setDocument( context );
751
774
  context = context || document;
752
775
 
753
776
  if ( documentIsHTML ) {
754
777
 
755
778
  // If the selector is sufficiently simple, try using a "get*By*" DOM method
756
779
  // (excepting DocumentFragment context, where the methods don't exist)
757
- if ( nodeType !== 11 && (match = rquickExpr.exec( selector )) ) {
780
+ if ( nodeType !== 11 && ( match = rquickExpr.exec( selector ) ) ) {
758
781
 
759
782
  // ID selector
760
- if ( (m = match[1]) ) {
783
+ if ( ( m = match[ 1 ] ) ) {
761
784
 
762
785
  // Document context
763
786
  if ( nodeType === 9 ) {
764
- if ( (elem = context.getElementById( m )) ) {
787
+ if ( ( elem = context.getElementById( m ) ) ) {
765
788
 
766
789
  // Support: IE, Opera, Webkit
767
790
  // TODO: identify versions
@@ -780,7 +803,7 @@ function Sizzle( selector, context, results, seed ) {
780
803
  // Support: IE, Opera, Webkit
781
804
  // TODO: identify versions
782
805
  // getElementById can match elements by name instead of ID
783
- if ( newContext && (elem = newContext.getElementById( m )) &&
806
+ if ( newContext && ( elem = newContext.getElementById( m ) ) &&
784
807
  contains( context, elem ) &&
785
808
  elem.id === m ) {
786
809
 
@@ -790,12 +813,12 @@ function Sizzle( selector, context, results, seed ) {
790
813
  }
791
814
 
792
815
  // Type selector
793
- } else if ( match[2] ) {
816
+ } else if ( match[ 2 ] ) {
794
817
  push.apply( results, context.getElementsByTagName( selector ) );
795
818
  return results;
796
819
 
797
820
  // Class selector
798
- } else if ( (m = match[3]) && support.getElementsByClassName &&
821
+ } else if ( ( m = match[ 3 ] ) && support.getElementsByClassName &&
799
822
  context.getElementsByClassName ) {
800
823
 
801
824
  push.apply( results, context.getElementsByClassName( m ) );
@@ -806,11 +829,11 @@ function Sizzle( selector, context, results, seed ) {
806
829
  // Take advantage of querySelectorAll
807
830
  if ( support.qsa &&
808
831
  !nonnativeSelectorCache[ selector + " " ] &&
809
- (!rbuggyQSA || !rbuggyQSA.test( selector )) &&
832
+ ( !rbuggyQSA || !rbuggyQSA.test( selector ) ) &&
810
833
 
811
834
  // Support: IE 8 only
812
835
  // Exclude object elements
813
- (nodeType !== 1 || context.nodeName.toLowerCase() !== "object") ) {
836
+ ( nodeType !== 1 || context.nodeName.toLowerCase() !== "object" ) ) {
814
837
 
815
838
  newSelector = selector;
816
839
  newContext = context;
@@ -819,27 +842,36 @@ function Sizzle( selector, context, results, seed ) {
819
842
  // descendant combinators, which is not what we want.
820
843
  // In such cases, we work around the behavior by prefixing every selector in the
821
844
  // list with an ID selector referencing the scope context.
845
+ // The technique has to be used as well when a leading combinator is used
846
+ // as such selectors are not recognized by querySelectorAll.
822
847
  // Thanks to Andrew Dupont for this technique.
823
- if ( nodeType === 1 && rdescend.test( selector ) ) {
848
+ if ( nodeType === 1 &&
849
+ ( rdescend.test( selector ) || rcombinators.test( selector ) ) ) {
824
850
 
825
- // Capture the context ID, setting it first if necessary
826
- if ( (nid = context.getAttribute( "id" )) ) {
827
- nid = nid.replace( rcssescape, fcssescape );
828
- } else {
829
- context.setAttribute( "id", (nid = expando) );
851
+ // Expand context for sibling selectors
852
+ newContext = rsibling.test( selector ) && testContext( context.parentNode ) ||
853
+ context;
854
+
855
+ // We can use :scope instead of the ID hack if the browser
856
+ // supports it & if we're not changing the context.
857
+ if ( newContext !== context || !support.scope ) {
858
+
859
+ // Capture the context ID, setting it first if necessary
860
+ if ( ( nid = context.getAttribute( "id" ) ) ) {
861
+ nid = nid.replace( rcssescape, fcssescape );
862
+ } else {
863
+ context.setAttribute( "id", ( nid = expando ) );
864
+ }
830
865
  }
831
866
 
832
867
  // Prefix every selector in the list
833
868
  groups = tokenize( selector );
834
869
  i = groups.length;
835
870
  while ( i-- ) {
836
- groups[i] = "#" + nid + " " + toSelector( groups[i] );
871
+ groups[ i ] = ( nid ? "#" + nid : ":scope" ) + " " +
872
+ toSelector( groups[ i ] );
837
873
  }
838
874
  newSelector = groups.join( "," );
839
-
840
- // Expand context for sibling selectors
841
- newContext = rsibling.test( selector ) && testContext( context.parentNode ) ||
842
- context;
843
875
  }
844
876
 
845
877
  try {
@@ -872,12 +904,14 @@ function createCache() {
872
904
  var keys = [];
873
905
 
874
906
  function cache( key, value ) {
907
+
875
908
  // Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
876
909
  if ( keys.push( key + " " ) > Expr.cacheLength ) {
910
+
877
911
  // Only keep the most recent entries
878
912
  delete cache[ keys.shift() ];
879
913
  }
880
- return (cache[ key + " " ] = value);
914
+ return ( cache[ key + " " ] = value );
881
915
  }
882
916
  return cache;
883
917
  }
@@ -896,17 +930,19 @@ function markFunction( fn ) {
896
930
  * @param {Function} fn Passed the created element and returns a boolean result
897
931
  */
898
932
  function assert( fn ) {
899
- var el = document.createElement("fieldset");
933
+ var el = document.createElement( "fieldset" );
900
934
 
901
935
  try {
902
936
  return !!fn( el );
903
- } catch (e) {
937
+ } catch ( e ) {
904
938
  return false;
905
939
  } finally {
940
+
906
941
  // Remove from its parent by default
907
942
  if ( el.parentNode ) {
908
943
  el.parentNode.removeChild( el );
909
944
  }
945
+
910
946
  // release memory in IE
911
947
  el = null;
912
948
  }
@@ -918,11 +954,11 @@ function assert( fn ) {
918
954
  * @param {Function} handler The method that will be applied
919
955
  */
920
956
  function addHandle( attrs, handler ) {
921
- var arr = attrs.split("|"),
957
+ var arr = attrs.split( "|" ),
922
958
  i = arr.length;
923
959
 
924
960
  while ( i-- ) {
925
- Expr.attrHandle[ arr[i] ] = handler;
961
+ Expr.attrHandle[ arr[ i ] ] = handler;
926
962
  }
927
963
  }
928
964
 
@@ -944,7 +980,7 @@ function siblingCheck( a, b ) {
944
980
 
945
981
  // Check if b follows a
946
982
  if ( cur ) {
947
- while ( (cur = cur.nextSibling) ) {
983
+ while ( ( cur = cur.nextSibling ) ) {
948
984
  if ( cur === b ) {
949
985
  return -1;
950
986
  }
@@ -972,7 +1008,7 @@ function createInputPseudo( type ) {
972
1008
  function createButtonPseudo( type ) {
973
1009
  return function( elem ) {
974
1010
  var name = elem.nodeName.toLowerCase();
975
- return (name === "input" || name === "button") && elem.type === type;
1011
+ return ( name === "input" || name === "button" ) && elem.type === type;
976
1012
  };
977
1013
  }
978
1014
 
@@ -1015,7 +1051,7 @@ function createDisabledPseudo( disabled ) {
1015
1051
  // Where there is no isDisabled, check manually
1016
1052
  /* jshint -W018 */
1017
1053
  elem.isDisabled !== !disabled &&
1018
- inDisabledFieldset( elem ) === disabled;
1054
+ inDisabledFieldset( elem ) === disabled;
1019
1055
  }
1020
1056
 
1021
1057
  return elem.disabled === disabled;
@@ -1037,21 +1073,21 @@ function createDisabledPseudo( disabled ) {
1037
1073
  * @param {Function} fn
1038
1074
  */
1039
1075
  function createPositionalPseudo( fn ) {
1040
- return markFunction(function( argument ) {
1076
+ return markFunction( function( argument ) {
1041
1077
  argument = +argument;
1042
- return markFunction(function( seed, matches ) {
1078
+ return markFunction( function( seed, matches ) {
1043
1079
  var j,
1044
1080
  matchIndexes = fn( [], seed.length, argument ),
1045
1081
  i = matchIndexes.length;
1046
1082
 
1047
1083
  // Match elements found at the specified indexes
1048
1084
  while ( i-- ) {
1049
- if ( seed[ (j = matchIndexes[i]) ] ) {
1050
- seed[j] = !(matches[j] = seed[j]);
1085
+ if ( seed[ ( j = matchIndexes[ i ] ) ] ) {
1086
+ seed[ j ] = !( matches[ j ] = seed[ j ] );
1051
1087
  }
1052
1088
  }
1053
- });
1054
- });
1089
+ } );
1090
+ } );
1055
1091
  }
1056
1092
 
1057
1093
  /**
@@ -1073,7 +1109,7 @@ support = Sizzle.support = {};
1073
1109
  */
1074
1110
  isXML = Sizzle.isXML = function( elem ) {
1075
1111
  var namespace = elem.namespaceURI,
1076
- docElem = (elem.ownerDocument || elem).documentElement;
1112
+ docElem = ( elem.ownerDocument || elem ).documentElement;
1077
1113
 
1078
1114
  // Support: IE <=8
1079
1115
  // Assume HTML when documentElement doesn't yet exist, such as inside loading iframes
@@ -1091,7 +1127,11 @@ setDocument = Sizzle.setDocument = function( node ) {
1091
1127
  doc = node ? node.ownerDocument || node : preferredDoc;
1092
1128
 
1093
1129
  // Return early if doc is invalid or already selected
1094
- if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) {
1130
+ // Support: IE 11+, Edge 17 - 18+
1131
+ // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
1132
+ // two documents; shallow comparisons work.
1133
+ // eslint-disable-next-line eqeqeq
1134
+ if ( doc == document || doc.nodeType !== 9 || !doc.documentElement ) {
1095
1135
  return document;
1096
1136
  }
1097
1137
 
@@ -1100,10 +1140,14 @@ setDocument = Sizzle.setDocument = function( node ) {
1100
1140
  docElem = document.documentElement;
1101
1141
  documentIsHTML = !isXML( document );
1102
1142
 
1103
- // Support: IE 9-11, Edge
1143
+ // Support: IE 9 - 11+, Edge 12 - 18+
1104
1144
  // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936)
1105
- if ( preferredDoc !== document &&
1106
- (subWindow = document.defaultView) && subWindow.top !== subWindow ) {
1145
+ // Support: IE 11+, Edge 17 - 18+
1146
+ // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
1147
+ // two documents; shallow comparisons work.
1148
+ // eslint-disable-next-line eqeqeq
1149
+ if ( preferredDoc != document &&
1150
+ ( subWindow = document.defaultView ) && subWindow.top !== subWindow ) {
1107
1151
 
1108
1152
  // Support: IE 11, Edge
1109
1153
  if ( subWindow.addEventListener ) {
@@ -1115,25 +1159,36 @@ setDocument = Sizzle.setDocument = function( node ) {
1115
1159
  }
1116
1160
  }
1117
1161
 
1162
+ // Support: IE 8 - 11+, Edge 12 - 18+, Chrome <=16 - 25 only, Firefox <=3.6 - 31 only,
1163
+ // Safari 4 - 5 only, Opera <=11.6 - 12.x only
1164
+ // IE/Edge & older browsers don't support the :scope pseudo-class.
1165
+ // Support: Safari 6.0 only
1166
+ // Safari 6.0 supports :scope but it's an alias of :root there.
1167
+ support.scope = assert( function( el ) {
1168
+ docElem.appendChild( el ).appendChild( document.createElement( "div" ) );
1169
+ return typeof el.querySelectorAll !== "undefined" &&
1170
+ !el.querySelectorAll( ":scope fieldset div" ).length;
1171
+ } );
1172
+
1118
1173
  /* Attributes
1119
1174
  ---------------------------------------------------------------------- */
1120
1175
 
1121
1176
  // Support: IE<8
1122
1177
  // Verify that getAttribute really returns attributes and not properties
1123
1178
  // (excepting IE8 booleans)
1124
- support.attributes = assert(function( el ) {
1179
+ support.attributes = assert( function( el ) {
1125
1180
  el.className = "i";
1126
- return !el.getAttribute("className");
1127
- });
1181
+ return !el.getAttribute( "className" );
1182
+ } );
1128
1183
 
1129
1184
  /* getElement(s)By*
1130
1185
  ---------------------------------------------------------------------- */
1131
1186
 
1132
1187
  // Check if getElementsByTagName("*") returns only elements
1133
- support.getElementsByTagName = assert(function( el ) {
1134
- el.appendChild( document.createComment("") );
1135
- return !el.getElementsByTagName("*").length;
1136
- });
1188
+ support.getElementsByTagName = assert( function( el ) {
1189
+ el.appendChild( document.createComment( "" ) );
1190
+ return !el.getElementsByTagName( "*" ).length;
1191
+ } );
1137
1192
 
1138
1193
  // Support: IE<9
1139
1194
  support.getElementsByClassName = rnative.test( document.getElementsByClassName );
@@ -1142,38 +1197,38 @@ setDocument = Sizzle.setDocument = function( node ) {
1142
1197
  // Check if getElementById returns elements by name
1143
1198
  // The broken getElementById methods don't pick up programmatically-set names,
1144
1199
  // so use a roundabout getElementsByName test
1145
- support.getById = assert(function( el ) {
1200
+ support.getById = assert( function( el ) {
1146
1201
  docElem.appendChild( el ).id = expando;
1147
1202
  return !document.getElementsByName || !document.getElementsByName( expando ).length;
1148
- });
1203
+ } );
1149
1204
 
1150
1205
  // ID filter and find
1151
1206
  if ( support.getById ) {
1152
- Expr.filter["ID"] = function( id ) {
1207
+ Expr.filter[ "ID" ] = function( id ) {
1153
1208
  var attrId = id.replace( runescape, funescape );
1154
1209
  return function( elem ) {
1155
- return elem.getAttribute("id") === attrId;
1210
+ return elem.getAttribute( "id" ) === attrId;
1156
1211
  };
1157
1212
  };
1158
- Expr.find["ID"] = function( id, context ) {
1213
+ Expr.find[ "ID" ] = function( id, context ) {
1159
1214
  if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
1160
1215
  var elem = context.getElementById( id );
1161
1216
  return elem ? [ elem ] : [];
1162
1217
  }
1163
1218
  };
1164
1219
  } else {
1165
- Expr.filter["ID"] = function( id ) {
1220
+ Expr.filter[ "ID" ] = function( id ) {
1166
1221
  var attrId = id.replace( runescape, funescape );
1167
1222
  return function( elem ) {
1168
1223
  var node = typeof elem.getAttributeNode !== "undefined" &&
1169
- elem.getAttributeNode("id");
1224
+ elem.getAttributeNode( "id" );
1170
1225
  return node && node.value === attrId;
1171
1226
  };
1172
1227
  };
1173
1228
 
1174
1229
  // Support: IE 6 - 7 only
1175
1230
  // getElementById is not reliable as a find shortcut
1176
- Expr.find["ID"] = function( id, context ) {
1231
+ Expr.find[ "ID" ] = function( id, context ) {
1177
1232
  if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
1178
1233
  var node, i, elems,
1179
1234
  elem = context.getElementById( id );
@@ -1181,7 +1236,7 @@ setDocument = Sizzle.setDocument = function( node ) {
1181
1236
  if ( elem ) {
1182
1237
 
1183
1238
  // Verify the id attribute
1184
- node = elem.getAttributeNode("id");
1239
+ node = elem.getAttributeNode( "id" );
1185
1240
  if ( node && node.value === id ) {
1186
1241
  return [ elem ];
1187
1242
  }
@@ -1189,8 +1244,8 @@ setDocument = Sizzle.setDocument = function( node ) {
1189
1244
  // Fall back on getElementsByName
1190
1245
  elems = context.getElementsByName( id );
1191
1246
  i = 0;
1192
- while ( (elem = elems[i++]) ) {
1193
- node = elem.getAttributeNode("id");
1247
+ while ( ( elem = elems[ i++ ] ) ) {
1248
+ node = elem.getAttributeNode( "id" );
1194
1249
  if ( node && node.value === id ) {
1195
1250
  return [ elem ];
1196
1251
  }
@@ -1203,7 +1258,7 @@ setDocument = Sizzle.setDocument = function( node ) {
1203
1258
  }
1204
1259
 
1205
1260
  // Tag
1206
- Expr.find["TAG"] = support.getElementsByTagName ?
1261
+ Expr.find[ "TAG" ] = support.getElementsByTagName ?
1207
1262
  function( tag, context ) {
1208
1263
  if ( typeof context.getElementsByTagName !== "undefined" ) {
1209
1264
  return context.getElementsByTagName( tag );
@@ -1218,12 +1273,13 @@ setDocument = Sizzle.setDocument = function( node ) {
1218
1273
  var elem,
1219
1274
  tmp = [],
1220
1275
  i = 0,
1276
+
1221
1277
  // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too
1222
1278
  results = context.getElementsByTagName( tag );
1223
1279
 
1224
1280
  // Filter out possible comments
1225
1281
  if ( tag === "*" ) {
1226
- while ( (elem = results[i++]) ) {
1282
+ while ( ( elem = results[ i++ ] ) ) {
1227
1283
  if ( elem.nodeType === 1 ) {
1228
1284
  tmp.push( elem );
1229
1285
  }
@@ -1235,7 +1291,7 @@ setDocument = Sizzle.setDocument = function( node ) {
1235
1291
  };
1236
1292
 
1237
1293
  // Class
1238
- Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) {
1294
+ Expr.find[ "CLASS" ] = support.getElementsByClassName && function( className, context ) {
1239
1295
  if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) {
1240
1296
  return context.getElementsByClassName( className );
1241
1297
  }
@@ -1256,10 +1312,14 @@ setDocument = Sizzle.setDocument = function( node ) {
1256
1312
  // See https://bugs.jquery.com/ticket/13378
1257
1313
  rbuggyQSA = [];
1258
1314
 
1259
- if ( (support.qsa = rnative.test( document.querySelectorAll )) ) {
1315
+ if ( ( support.qsa = rnative.test( document.querySelectorAll ) ) ) {
1316
+
1260
1317
  // Build QSA regex
1261
1318
  // Regex strategy adopted from Diego Perini
1262
- assert(function( el ) {
1319
+ assert( function( el ) {
1320
+
1321
+ var input;
1322
+
1263
1323
  // Select is set to empty string on purpose
1264
1324
  // This is to test IE's treatment of not explicitly
1265
1325
  // setting a boolean content attribute,
@@ -1273,78 +1333,98 @@ setDocument = Sizzle.setDocument = function( node ) {
1273
1333
  // Nothing should be selected when empty strings follow ^= or $= or *=
1274
1334
  // The test attribute must be unknown in Opera but "safe" for WinRT
1275
1335
  // https://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section
1276
- if ( el.querySelectorAll("[msallowcapture^='']").length ) {
1336
+ if ( el.querySelectorAll( "[msallowcapture^='']" ).length ) {
1277
1337
  rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" );
1278
1338
  }
1279
1339
 
1280
1340
  // Support: IE8
1281
1341
  // Boolean attributes and "value" are not treated correctly
1282
- if ( !el.querySelectorAll("[selected]").length ) {
1342
+ if ( !el.querySelectorAll( "[selected]" ).length ) {
1283
1343
  rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" );
1284
1344
  }
1285
1345
 
1286
1346
  // Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+
1287
1347
  if ( !el.querySelectorAll( "[id~=" + expando + "-]" ).length ) {
1288
- rbuggyQSA.push("~=");
1348
+ rbuggyQSA.push( "~=" );
1349
+ }
1350
+
1351
+ // Support: IE 11+, Edge 15 - 18+
1352
+ // IE 11/Edge don't find elements on a `[name='']` query in some cases.
1353
+ // Adding a temporary attribute to the document before the selection works
1354
+ // around the issue.
1355
+ // Interestingly, IE 10 & older don't seem to have the issue.
1356
+ input = document.createElement( "input" );
1357
+ input.setAttribute( "name", "" );
1358
+ el.appendChild( input );
1359
+ if ( !el.querySelectorAll( "[name='']" ).length ) {
1360
+ rbuggyQSA.push( "\\[" + whitespace + "*name" + whitespace + "*=" +
1361
+ whitespace + "*(?:''|\"\")" );
1289
1362
  }
1290
1363
 
1291
1364
  // Webkit/Opera - :checked should return selected option elements
1292
1365
  // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
1293
1366
  // IE8 throws error here and will not see later tests
1294
- if ( !el.querySelectorAll(":checked").length ) {
1295
- rbuggyQSA.push(":checked");
1367
+ if ( !el.querySelectorAll( ":checked" ).length ) {
1368
+ rbuggyQSA.push( ":checked" );
1296
1369
  }
1297
1370
 
1298
1371
  // Support: Safari 8+, iOS 8+
1299
1372
  // https://bugs.webkit.org/show_bug.cgi?id=136851
1300
1373
  // In-page `selector#id sibling-combinator selector` fails
1301
1374
  if ( !el.querySelectorAll( "a#" + expando + "+*" ).length ) {
1302
- rbuggyQSA.push(".#.+[+~]");
1375
+ rbuggyQSA.push( ".#.+[+~]" );
1303
1376
  }
1304
- });
1305
1377
 
1306
- assert(function( el ) {
1378
+ // Support: Firefox <=3.6 - 5 only
1379
+ // Old Firefox doesn't throw on a badly-escaped identifier.
1380
+ el.querySelectorAll( "\\\f" );
1381
+ rbuggyQSA.push( "[\\r\\n\\f]" );
1382
+ } );
1383
+
1384
+ assert( function( el ) {
1307
1385
  el.innerHTML = "<a href='' disabled='disabled'></a>" +
1308
1386
  "<select disabled='disabled'><option/></select>";
1309
1387
 
1310
1388
  // Support: Windows 8 Native Apps
1311
1389
  // The type and name attributes are restricted during .innerHTML assignment
1312
- var input = document.createElement("input");
1390
+ var input = document.createElement( "input" );
1313
1391
  input.setAttribute( "type", "hidden" );
1314
1392
  el.appendChild( input ).setAttribute( "name", "D" );
1315
1393
 
1316
1394
  // Support: IE8
1317
1395
  // Enforce case-sensitivity of name attribute
1318
- if ( el.querySelectorAll("[name=d]").length ) {
1396
+ if ( el.querySelectorAll( "[name=d]" ).length ) {
1319
1397
  rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" );
1320
1398
  }
1321
1399
 
1322
1400
  // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
1323
1401
  // IE8 throws error here and will not see later tests
1324
- if ( el.querySelectorAll(":enabled").length !== 2 ) {
1402
+ if ( el.querySelectorAll( ":enabled" ).length !== 2 ) {
1325
1403
  rbuggyQSA.push( ":enabled", ":disabled" );
1326
1404
  }
1327
1405
 
1328
1406
  // Support: IE9-11+
1329
1407
  // IE's :disabled selector does not pick up the children of disabled fieldsets
1330
1408
  docElem.appendChild( el ).disabled = true;
1331
- if ( el.querySelectorAll(":disabled").length !== 2 ) {
1409
+ if ( el.querySelectorAll( ":disabled" ).length !== 2 ) {
1332
1410
  rbuggyQSA.push( ":enabled", ":disabled" );
1333
1411
  }
1334
1412
 
1413
+ // Support: Opera 10 - 11 only
1335
1414
  // Opera 10-11 does not throw on post-comma invalid pseudos
1336
- el.querySelectorAll("*,:x");
1337
- rbuggyQSA.push(",.*:");
1338
- });
1415
+ el.querySelectorAll( "*,:x" );
1416
+ rbuggyQSA.push( ",.*:" );
1417
+ } );
1339
1418
  }
1340
1419
 
1341
- if ( (support.matchesSelector = rnative.test( (matches = docElem.matches ||
1420
+ if ( ( support.matchesSelector = rnative.test( ( matches = docElem.matches ||
1342
1421
  docElem.webkitMatchesSelector ||
1343
1422
  docElem.mozMatchesSelector ||
1344
1423
  docElem.oMatchesSelector ||
1345
- docElem.msMatchesSelector) )) ) {
1424
+ docElem.msMatchesSelector ) ) ) ) {
1425
+
1426
+ assert( function( el ) {
1346
1427
 
1347
- assert(function( el ) {
1348
1428
  // Check to see if it's possible to do matchesSelector
1349
1429
  // on a disconnected node (IE 9)
1350
1430
  support.disconnectedMatch = matches.call( el, "*" );
@@ -1353,11 +1433,11 @@ setDocument = Sizzle.setDocument = function( node ) {
1353
1433
  // Gecko does not error, returns false instead
1354
1434
  matches.call( el, "[s!='']:x" );
1355
1435
  rbuggyMatches.push( "!=", pseudos );
1356
- });
1436
+ } );
1357
1437
  }
1358
1438
 
1359
- rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") );
1360
- rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") );
1439
+ rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join( "|" ) );
1440
+ rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join( "|" ) );
1361
1441
 
1362
1442
  /* Contains
1363
1443
  ---------------------------------------------------------------------- */
@@ -1374,11 +1454,11 @@ setDocument = Sizzle.setDocument = function( node ) {
1374
1454
  adown.contains ?
1375
1455
  adown.contains( bup ) :
1376
1456
  a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
1377
- ));
1457
+ ) );
1378
1458
  } :
1379
1459
  function( a, b ) {
1380
1460
  if ( b ) {
1381
- while ( (b = b.parentNode) ) {
1461
+ while ( ( b = b.parentNode ) ) {
1382
1462
  if ( b === a ) {
1383
1463
  return true;
1384
1464
  }
@@ -1407,7 +1487,11 @@ setDocument = Sizzle.setDocument = function( node ) {
1407
1487
  }
1408
1488
 
1409
1489
  // Calculate position if both inputs belong to the same document
1410
- compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ?
1490
+ // Support: IE 11+, Edge 17 - 18+
1491
+ // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
1492
+ // two documents; shallow comparisons work.
1493
+ // eslint-disable-next-line eqeqeq
1494
+ compare = ( a.ownerDocument || a ) == ( b.ownerDocument || b ) ?
1411
1495
  a.compareDocumentPosition( b ) :
1412
1496
 
1413
1497
  // Otherwise we know they are disconnected
@@ -1415,13 +1499,24 @@ setDocument = Sizzle.setDocument = function( node ) {
1415
1499
 
1416
1500
  // Disconnected nodes
1417
1501
  if ( compare & 1 ||
1418
- (!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) {
1502
+ ( !support.sortDetached && b.compareDocumentPosition( a ) === compare ) ) {
1419
1503
 
1420
1504
  // Choose the first element that is related to our preferred document
1421
- if ( a === document || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) {
1505
+ // Support: IE 11+, Edge 17 - 18+
1506
+ // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
1507
+ // two documents; shallow comparisons work.
1508
+ // eslint-disable-next-line eqeqeq
1509
+ if ( a == document || a.ownerDocument == preferredDoc &&
1510
+ contains( preferredDoc, a ) ) {
1422
1511
  return -1;
1423
1512
  }
1424
- if ( b === document || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) {
1513
+
1514
+ // Support: IE 11+, Edge 17 - 18+
1515
+ // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
1516
+ // two documents; shallow comparisons work.
1517
+ // eslint-disable-next-line eqeqeq
1518
+ if ( b == document || b.ownerDocument == preferredDoc &&
1519
+ contains( preferredDoc, b ) ) {
1425
1520
  return 1;
1426
1521
  }
1427
1522
 
@@ -1434,6 +1529,7 @@ setDocument = Sizzle.setDocument = function( node ) {
1434
1529
  return compare & 4 ? -1 : 1;
1435
1530
  } :
1436
1531
  function( a, b ) {
1532
+
1437
1533
  // Exit early if the nodes are identical
1438
1534
  if ( a === b ) {
1439
1535
  hasDuplicate = true;
@@ -1449,8 +1545,14 @@ setDocument = Sizzle.setDocument = function( node ) {
1449
1545
 
1450
1546
  // Parentless nodes are either documents or disconnected
1451
1547
  if ( !aup || !bup ) {
1452
- return a === document ? -1 :
1453
- b === document ? 1 :
1548
+
1549
+ // Support: IE 11+, Edge 17 - 18+
1550
+ // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
1551
+ // two documents; shallow comparisons work.
1552
+ /* eslint-disable eqeqeq */
1553
+ return a == document ? -1 :
1554
+ b == document ? 1 :
1555
+ /* eslint-enable eqeqeq */
1454
1556
  aup ? -1 :
1455
1557
  bup ? 1 :
1456
1558
  sortInput ?
@@ -1464,26 +1566,32 @@ setDocument = Sizzle.setDocument = function( node ) {
1464
1566
 
1465
1567
  // Otherwise we need full lists of their ancestors for comparison
1466
1568
  cur = a;
1467
- while ( (cur = cur.parentNode) ) {
1569
+ while ( ( cur = cur.parentNode ) ) {
1468
1570
  ap.unshift( cur );
1469
1571
  }
1470
1572
  cur = b;
1471
- while ( (cur = cur.parentNode) ) {
1573
+ while ( ( cur = cur.parentNode ) ) {
1472
1574
  bp.unshift( cur );
1473
1575
  }
1474
1576
 
1475
1577
  // Walk down the tree looking for a discrepancy
1476
- while ( ap[i] === bp[i] ) {
1578
+ while ( ap[ i ] === bp[ i ] ) {
1477
1579
  i++;
1478
1580
  }
1479
1581
 
1480
1582
  return i ?
1583
+
1481
1584
  // Do a sibling check if the nodes have a common ancestor
1482
- siblingCheck( ap[i], bp[i] ) :
1585
+ siblingCheck( ap[ i ], bp[ i ] ) :
1483
1586
 
1484
1587
  // Otherwise nodes in our document sort first
1485
- ap[i] === preferredDoc ? -1 :
1486
- bp[i] === preferredDoc ? 1 :
1588
+ // Support: IE 11+, Edge 17 - 18+
1589
+ // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
1590
+ // two documents; shallow comparisons work.
1591
+ /* eslint-disable eqeqeq */
1592
+ ap[ i ] == preferredDoc ? -1 :
1593
+ bp[ i ] == preferredDoc ? 1 :
1594
+ /* eslint-enable eqeqeq */
1487
1595
  0;
1488
1596
  };
1489
1597
 
@@ -1495,10 +1603,7 @@ Sizzle.matches = function( expr, elements ) {
1495
1603
  };
1496
1604
 
1497
1605
  Sizzle.matchesSelector = function( elem, expr ) {
1498
- // Set document vars if needed
1499
- if ( ( elem.ownerDocument || elem ) !== document ) {
1500
- setDocument( elem );
1501
- }
1606
+ setDocument( elem );
1502
1607
 
1503
1608
  if ( support.matchesSelector && documentIsHTML &&
1504
1609
  !nonnativeSelectorCache[ expr + " " ] &&
@@ -1510,12 +1615,13 @@ Sizzle.matchesSelector = function( elem, expr ) {
1510
1615
 
1511
1616
  // IE 9's matchesSelector returns false on disconnected nodes
1512
1617
  if ( ret || support.disconnectedMatch ||
1513
- // As well, disconnected nodes are said to be in a document
1514
- // fragment in IE 9
1515
- elem.document && elem.document.nodeType !== 11 ) {
1618
+
1619
+ // As well, disconnected nodes are said to be in a document
1620
+ // fragment in IE 9
1621
+ elem.document && elem.document.nodeType !== 11 ) {
1516
1622
  return ret;
1517
1623
  }
1518
- } catch (e) {
1624
+ } catch ( e ) {
1519
1625
  nonnativeSelectorCache( expr, true );
1520
1626
  }
1521
1627
  }
@@ -1524,20 +1630,31 @@ Sizzle.matchesSelector = function( elem, expr ) {
1524
1630
  };
1525
1631
 
1526
1632
  Sizzle.contains = function( context, elem ) {
1633
+
1527
1634
  // Set document vars if needed
1528
- if ( ( context.ownerDocument || context ) !== document ) {
1635
+ // Support: IE 11+, Edge 17 - 18+
1636
+ // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
1637
+ // two documents; shallow comparisons work.
1638
+ // eslint-disable-next-line eqeqeq
1639
+ if ( ( context.ownerDocument || context ) != document ) {
1529
1640
  setDocument( context );
1530
1641
  }
1531
1642
  return contains( context, elem );
1532
1643
  };
1533
1644
 
1534
1645
  Sizzle.attr = function( elem, name ) {
1646
+
1535
1647
  // Set document vars if needed
1536
- if ( ( elem.ownerDocument || elem ) !== document ) {
1648
+ // Support: IE 11+, Edge 17 - 18+
1649
+ // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
1650
+ // two documents; shallow comparisons work.
1651
+ // eslint-disable-next-line eqeqeq
1652
+ if ( ( elem.ownerDocument || elem ) != document ) {
1537
1653
  setDocument( elem );
1538
1654
  }
1539
1655
 
1540
1656
  var fn = Expr.attrHandle[ name.toLowerCase() ],
1657
+
1541
1658
  // Don't get fooled by Object.prototype properties (jQuery #13807)
1542
1659
  val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ?
1543
1660
  fn( elem, name, !documentIsHTML ) :
@@ -1547,13 +1664,13 @@ Sizzle.attr = function( elem, name ) {
1547
1664
  val :
1548
1665
  support.attributes || !documentIsHTML ?
1549
1666
  elem.getAttribute( name ) :
1550
- (val = elem.getAttributeNode(name)) && val.specified ?
1667
+ ( val = elem.getAttributeNode( name ) ) && val.specified ?
1551
1668
  val.value :
1552
1669
  null;
1553
1670
  };
1554
1671
 
1555
1672
  Sizzle.escape = function( sel ) {
1556
- return (sel + "").replace( rcssescape, fcssescape );
1673
+ return ( sel + "" ).replace( rcssescape, fcssescape );
1557
1674
  };
1558
1675
 
1559
1676
  Sizzle.error = function( msg ) {
@@ -1576,7 +1693,7 @@ Sizzle.uniqueSort = function( results ) {
1576
1693
  results.sort( sortOrder );
1577
1694
 
1578
1695
  if ( hasDuplicate ) {
1579
- while ( (elem = results[i++]) ) {
1696
+ while ( ( elem = results[ i++ ] ) ) {
1580
1697
  if ( elem === results[ i ] ) {
1581
1698
  j = duplicates.push( i );
1582
1699
  }
@@ -1604,17 +1721,21 @@ getText = Sizzle.getText = function( elem ) {
1604
1721
  nodeType = elem.nodeType;
1605
1722
 
1606
1723
  if ( !nodeType ) {
1724
+
1607
1725
  // If no nodeType, this is expected to be an array
1608
- while ( (node = elem[i++]) ) {
1726
+ while ( ( node = elem[ i++ ] ) ) {
1727
+
1609
1728
  // Do not traverse comment nodes
1610
1729
  ret += getText( node );
1611
1730
  }
1612
1731
  } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
1732
+
1613
1733
  // Use textContent for elements
1614
1734
  // innerText usage removed for consistency of new lines (jQuery #11153)
1615
1735
  if ( typeof elem.textContent === "string" ) {
1616
1736
  return elem.textContent;
1617
1737
  } else {
1738
+
1618
1739
  // Traverse its children
1619
1740
  for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
1620
1741
  ret += getText( elem );
@@ -1623,6 +1744,7 @@ getText = Sizzle.getText = function( elem ) {
1623
1744
  } else if ( nodeType === 3 || nodeType === 4 ) {
1624
1745
  return elem.nodeValue;
1625
1746
  }
1747
+
1626
1748
  // Do not include comment or processing instruction nodes
1627
1749
 
1628
1750
  return ret;
@@ -1650,19 +1772,21 @@ Expr = Sizzle.selectors = {
1650
1772
 
1651
1773
  preFilter: {
1652
1774
  "ATTR": function( match ) {
1653
- match[1] = match[1].replace( runescape, funescape );
1775
+ match[ 1 ] = match[ 1 ].replace( runescape, funescape );
1654
1776
 
1655
1777
  // Move the given value to match[3] whether quoted or unquoted
1656
- match[3] = ( match[3] || match[4] || match[5] || "" ).replace( runescape, funescape );
1778
+ match[ 3 ] = ( match[ 3 ] || match[ 4 ] ||
1779
+ match[ 5 ] || "" ).replace( runescape, funescape );
1657
1780
 
1658
- if ( match[2] === "~=" ) {
1659
- match[3] = " " + match[3] + " ";
1781
+ if ( match[ 2 ] === "~=" ) {
1782
+ match[ 3 ] = " " + match[ 3 ] + " ";
1660
1783
  }
1661
1784
 
1662
1785
  return match.slice( 0, 4 );
1663
1786
  },
1664
1787
 
1665
1788
  "CHILD": function( match ) {
1789
+
1666
1790
  /* matches from matchExpr["CHILD"]
1667
1791
  1 type (only|nth|...)
1668
1792
  2 what (child|of-type)
@@ -1673,22 +1797,25 @@ Expr = Sizzle.selectors = {
1673
1797
  7 sign of y-component
1674
1798
  8 y of y-component
1675
1799
  */
1676
- match[1] = match[1].toLowerCase();
1800
+ match[ 1 ] = match[ 1 ].toLowerCase();
1801
+
1802
+ if ( match[ 1 ].slice( 0, 3 ) === "nth" ) {
1677
1803
 
1678
- if ( match[1].slice( 0, 3 ) === "nth" ) {
1679
1804
  // nth-* requires argument
1680
- if ( !match[3] ) {
1681
- Sizzle.error( match[0] );
1805
+ if ( !match[ 3 ] ) {
1806
+ Sizzle.error( match[ 0 ] );
1682
1807
  }
1683
1808
 
1684
1809
  // numeric x and y parameters for Expr.filter.CHILD
1685
1810
  // remember that false/true cast respectively to 0/1
1686
- match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) );
1687
- match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" );
1811
+ match[ 4 ] = +( match[ 4 ] ?
1812
+ match[ 5 ] + ( match[ 6 ] || 1 ) :
1813
+ 2 * ( match[ 3 ] === "even" || match[ 3 ] === "odd" ) );
1814
+ match[ 5 ] = +( ( match[ 7 ] + match[ 8 ] ) || match[ 3 ] === "odd" );
1688
1815
 
1689
- // other types prohibit arguments
1690
- } else if ( match[3] ) {
1691
- Sizzle.error( match[0] );
1816
+ // other types prohibit arguments
1817
+ } else if ( match[ 3 ] ) {
1818
+ Sizzle.error( match[ 0 ] );
1692
1819
  }
1693
1820
 
1694
1821
  return match;
@@ -1696,26 +1823,28 @@ Expr = Sizzle.selectors = {
1696
1823
 
1697
1824
  "PSEUDO": function( match ) {
1698
1825
  var excess,
1699
- unquoted = !match[6] && match[2];
1826
+ unquoted = !match[ 6 ] && match[ 2 ];
1700
1827
 
1701
- if ( matchExpr["CHILD"].test( match[0] ) ) {
1828
+ if ( matchExpr[ "CHILD" ].test( match[ 0 ] ) ) {
1702
1829
  return null;
1703
1830
  }
1704
1831
 
1705
1832
  // Accept quoted arguments as-is
1706
- if ( match[3] ) {
1707
- match[2] = match[4] || match[5] || "";
1833
+ if ( match[ 3 ] ) {
1834
+ match[ 2 ] = match[ 4 ] || match[ 5 ] || "";
1708
1835
 
1709
1836
  // Strip excess characters from unquoted arguments
1710
1837
  } else if ( unquoted && rpseudo.test( unquoted ) &&
1838
+
1711
1839
  // Get excess from tokenize (recursively)
1712
- (excess = tokenize( unquoted, true )) &&
1840
+ ( excess = tokenize( unquoted, true ) ) &&
1841
+
1713
1842
  // advance to the next closing parenthesis
1714
- (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) {
1843
+ ( excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length ) ) {
1715
1844
 
1716
1845
  // excess is a negative index
1717
- match[0] = match[0].slice( 0, excess );
1718
- match[2] = unquoted.slice( 0, excess );
1846
+ match[ 0 ] = match[ 0 ].slice( 0, excess );
1847
+ match[ 2 ] = unquoted.slice( 0, excess );
1719
1848
  }
1720
1849
 
1721
1850
  // Return only captures needed by the pseudo filter method (type and argument)
@@ -1728,7 +1857,9 @@ Expr = Sizzle.selectors = {
1728
1857
  "TAG": function( nodeNameSelector ) {
1729
1858
  var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase();
1730
1859
  return nodeNameSelector === "*" ?
1731
- function() { return true; } :
1860
+ function() {
1861
+ return true;
1862
+ } :
1732
1863
  function( elem ) {
1733
1864
  return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
1734
1865
  };
@@ -1738,10 +1869,16 @@ Expr = Sizzle.selectors = {
1738
1869
  var pattern = classCache[ className + " " ];
1739
1870
 
1740
1871
  return pattern ||
1741
- (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) &&
1742
- classCache( className, function( elem ) {
1743
- return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "" );
1744
- });
1872
+ ( pattern = new RegExp( "(^|" + whitespace +
1873
+ ")" + className + "(" + whitespace + "|$)" ) ) && classCache(
1874
+ className, function( elem ) {
1875
+ return pattern.test(
1876
+ typeof elem.className === "string" && elem.className ||
1877
+ typeof elem.getAttribute !== "undefined" &&
1878
+ elem.getAttribute( "class" ) ||
1879
+ ""
1880
+ );
1881
+ } );
1745
1882
  },
1746
1883
 
1747
1884
  "ATTR": function( name, operator, check ) {
@@ -1757,6 +1894,8 @@ Expr = Sizzle.selectors = {
1757
1894
 
1758
1895
  result += "";
1759
1896
 
1897
+ /* eslint-disable max-len */
1898
+
1760
1899
  return operator === "=" ? result === check :
1761
1900
  operator === "!=" ? result !== check :
1762
1901
  operator === "^=" ? check && result.indexOf( check ) === 0 :
@@ -1765,10 +1904,12 @@ Expr = Sizzle.selectors = {
1765
1904
  operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 :
1766
1905
  operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" :
1767
1906
  false;
1907
+ /* eslint-enable max-len */
1908
+
1768
1909
  };
1769
1910
  },
1770
1911
 
1771
- "CHILD": function( type, what, argument, first, last ) {
1912
+ "CHILD": function( type, what, _argument, first, last ) {
1772
1913
  var simple = type.slice( 0, 3 ) !== "nth",
1773
1914
  forward = type.slice( -4 ) !== "last",
1774
1915
  ofType = what === "of-type";
@@ -1780,7 +1921,7 @@ Expr = Sizzle.selectors = {
1780
1921
  return !!elem.parentNode;
1781
1922
  } :
1782
1923
 
1783
- function( elem, context, xml ) {
1924
+ function( elem, _context, xml ) {
1784
1925
  var cache, uniqueCache, outerCache, node, nodeIndex, start,
1785
1926
  dir = simple !== forward ? "nextSibling" : "previousSibling",
1786
1927
  parent = elem.parentNode,
@@ -1794,7 +1935,7 @@ Expr = Sizzle.selectors = {
1794
1935
  if ( simple ) {
1795
1936
  while ( dir ) {
1796
1937
  node = elem;
1797
- while ( (node = node[ dir ]) ) {
1938
+ while ( ( node = node[ dir ] ) ) {
1798
1939
  if ( ofType ?
1799
1940
  node.nodeName.toLowerCase() === name :
1800
1941
  node.nodeType === 1 ) {
@@ -1802,6 +1943,7 @@ Expr = Sizzle.selectors = {
1802
1943
  return false;
1803
1944
  }
1804
1945
  }
1946
+
1805
1947
  // Reverse direction for :only-* (if we haven't yet done so)
1806
1948
  start = dir = type === "only" && !start && "nextSibling";
1807
1949
  }
@@ -1817,22 +1959,22 @@ Expr = Sizzle.selectors = {
1817
1959
 
1818
1960
  // ...in a gzip-friendly way
1819
1961
  node = parent;
1820
- outerCache = node[ expando ] || (node[ expando ] = {});
1962
+ outerCache = node[ expando ] || ( node[ expando ] = {} );
1821
1963
 
1822
1964
  // Support: IE <9 only
1823
1965
  // Defend against cloned attroperties (jQuery gh-1709)
1824
1966
  uniqueCache = outerCache[ node.uniqueID ] ||
1825
- (outerCache[ node.uniqueID ] = {});
1967
+ ( outerCache[ node.uniqueID ] = {} );
1826
1968
 
1827
1969
  cache = uniqueCache[ type ] || [];
1828
1970
  nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
1829
1971
  diff = nodeIndex && cache[ 2 ];
1830
1972
  node = nodeIndex && parent.childNodes[ nodeIndex ];
1831
1973
 
1832
- while ( (node = ++nodeIndex && node && node[ dir ] ||
1974
+ while ( ( node = ++nodeIndex && node && node[ dir ] ||
1833
1975
 
1834
1976
  // Fallback to seeking `elem` from the start
1835
- (diff = nodeIndex = 0) || start.pop()) ) {
1977
+ ( diff = nodeIndex = 0 ) || start.pop() ) ) {
1836
1978
 
1837
1979
  // When found, cache indexes on `parent` and break
1838
1980
  if ( node.nodeType === 1 && ++diff && node === elem ) {
@@ -1842,16 +1984,18 @@ Expr = Sizzle.selectors = {
1842
1984
  }
1843
1985
 
1844
1986
  } else {
1987
+
1845
1988
  // Use previously-cached element index if available
1846
1989
  if ( useCache ) {
1990
+
1847
1991
  // ...in a gzip-friendly way
1848
1992
  node = elem;
1849
- outerCache = node[ expando ] || (node[ expando ] = {});
1993
+ outerCache = node[ expando ] || ( node[ expando ] = {} );
1850
1994
 
1851
1995
  // Support: IE <9 only
1852
1996
  // Defend against cloned attroperties (jQuery gh-1709)
1853
1997
  uniqueCache = outerCache[ node.uniqueID ] ||
1854
- (outerCache[ node.uniqueID ] = {});
1998
+ ( outerCache[ node.uniqueID ] = {} );
1855
1999
 
1856
2000
  cache = uniqueCache[ type ] || [];
1857
2001
  nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
@@ -1861,9 +2005,10 @@ Expr = Sizzle.selectors = {
1861
2005
  // xml :nth-child(...)
1862
2006
  // or :nth-last-child(...) or :nth(-last)?-of-type(...)
1863
2007
  if ( diff === false ) {
2008
+
1864
2009
  // Use the same loop as above to seek `elem` from the start
1865
- while ( (node = ++nodeIndex && node && node[ dir ] ||
1866
- (diff = nodeIndex = 0) || start.pop()) ) {
2010
+ while ( ( node = ++nodeIndex && node && node[ dir ] ||
2011
+ ( diff = nodeIndex = 0 ) || start.pop() ) ) {
1867
2012
 
1868
2013
  if ( ( ofType ?
1869
2014
  node.nodeName.toLowerCase() === name :
@@ -1872,12 +2017,13 @@ Expr = Sizzle.selectors = {
1872
2017
 
1873
2018
  // Cache the index of each encountered element
1874
2019
  if ( useCache ) {
1875
- outerCache = node[ expando ] || (node[ expando ] = {});
2020
+ outerCache = node[ expando ] ||
2021
+ ( node[ expando ] = {} );
1876
2022
 
1877
2023
  // Support: IE <9 only
1878
2024
  // Defend against cloned attroperties (jQuery gh-1709)
1879
2025
  uniqueCache = outerCache[ node.uniqueID ] ||
1880
- (outerCache[ node.uniqueID ] = {});
2026
+ ( outerCache[ node.uniqueID ] = {} );
1881
2027
 
1882
2028
  uniqueCache[ type ] = [ dirruns, diff ];
1883
2029
  }
@@ -1898,6 +2044,7 @@ Expr = Sizzle.selectors = {
1898
2044
  },
1899
2045
 
1900
2046
  "PSEUDO": function( pseudo, argument ) {
2047
+
1901
2048
  // pseudo-class names are case-insensitive
1902
2049
  // http://www.w3.org/TR/selectors/#pseudo-classes
1903
2050
  // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
@@ -1917,15 +2064,15 @@ Expr = Sizzle.selectors = {
1917
2064
  if ( fn.length > 1 ) {
1918
2065
  args = [ pseudo, pseudo, "", argument ];
1919
2066
  return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?
1920
- markFunction(function( seed, matches ) {
2067
+ markFunction( function( seed, matches ) {
1921
2068
  var idx,
1922
2069
  matched = fn( seed, argument ),
1923
2070
  i = matched.length;
1924
2071
  while ( i-- ) {
1925
- idx = indexOf( seed, matched[i] );
1926
- seed[ idx ] = !( matches[ idx ] = matched[i] );
2072
+ idx = indexOf( seed, matched[ i ] );
2073
+ seed[ idx ] = !( matches[ idx ] = matched[ i ] );
1927
2074
  }
1928
- }) :
2075
+ } ) :
1929
2076
  function( elem ) {
1930
2077
  return fn( elem, 0, args );
1931
2078
  };
@@ -1936,8 +2083,10 @@ Expr = Sizzle.selectors = {
1936
2083
  },
1937
2084
 
1938
2085
  pseudos: {
2086
+
1939
2087
  // Potentially complex pseudos
1940
- "not": markFunction(function( selector ) {
2088
+ "not": markFunction( function( selector ) {
2089
+
1941
2090
  // Trim the selector passed to compile
1942
2091
  // to avoid treating leading and trailing
1943
2092
  // spaces as combinators
@@ -1946,39 +2095,40 @@ Expr = Sizzle.selectors = {
1946
2095
  matcher = compile( selector.replace( rtrim, "$1" ) );
1947
2096
 
1948
2097
  return matcher[ expando ] ?
1949
- markFunction(function( seed, matches, context, xml ) {
2098
+ markFunction( function( seed, matches, _context, xml ) {
1950
2099
  var elem,
1951
2100
  unmatched = matcher( seed, null, xml, [] ),
1952
2101
  i = seed.length;
1953
2102
 
1954
2103
  // Match elements unmatched by `matcher`
1955
2104
  while ( i-- ) {
1956
- if ( (elem = unmatched[i]) ) {
1957
- seed[i] = !(matches[i] = elem);
2105
+ if ( ( elem = unmatched[ i ] ) ) {
2106
+ seed[ i ] = !( matches[ i ] = elem );
1958
2107
  }
1959
2108
  }
1960
- }) :
1961
- function( elem, context, xml ) {
1962
- input[0] = elem;
2109
+ } ) :
2110
+ function( elem, _context, xml ) {
2111
+ input[ 0 ] = elem;
1963
2112
  matcher( input, null, xml, results );
2113
+
1964
2114
  // Don't keep the element (issue #299)
1965
- input[0] = null;
2115
+ input[ 0 ] = null;
1966
2116
  return !results.pop();
1967
2117
  };
1968
- }),
2118
+ } ),
1969
2119
 
1970
- "has": markFunction(function( selector ) {
2120
+ "has": markFunction( function( selector ) {
1971
2121
  return function( elem ) {
1972
2122
  return Sizzle( selector, elem ).length > 0;
1973
2123
  };
1974
- }),
2124
+ } ),
1975
2125
 
1976
- "contains": markFunction(function( text ) {
2126
+ "contains": markFunction( function( text ) {
1977
2127
  text = text.replace( runescape, funescape );
1978
2128
  return function( elem ) {
1979
2129
  return ( elem.textContent || getText( elem ) ).indexOf( text ) > -1;
1980
2130
  };
1981
- }),
2131
+ } ),
1982
2132
 
1983
2133
  // "Whether an element is represented by a :lang() selector
1984
2134
  // is based solely on the element's language value
@@ -1988,25 +2138,26 @@ Expr = Sizzle.selectors = {
1988
2138
  // The identifier C does not have to be a valid language name."
1989
2139
  // http://www.w3.org/TR/selectors/#lang-pseudo
1990
2140
  "lang": markFunction( function( lang ) {
2141
+
1991
2142
  // lang value must be a valid identifier
1992
- if ( !ridentifier.test(lang || "") ) {
2143
+ if ( !ridentifier.test( lang || "" ) ) {
1993
2144
  Sizzle.error( "unsupported lang: " + lang );
1994
2145
  }
1995
2146
  lang = lang.replace( runescape, funescape ).toLowerCase();
1996
2147
  return function( elem ) {
1997
2148
  var elemLang;
1998
2149
  do {
1999
- if ( (elemLang = documentIsHTML ?
2150
+ if ( ( elemLang = documentIsHTML ?
2000
2151
  elem.lang :
2001
- elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) {
2152
+ elem.getAttribute( "xml:lang" ) || elem.getAttribute( "lang" ) ) ) {
2002
2153
 
2003
2154
  elemLang = elemLang.toLowerCase();
2004
2155
  return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0;
2005
2156
  }
2006
- } while ( (elem = elem.parentNode) && elem.nodeType === 1 );
2157
+ } while ( ( elem = elem.parentNode ) && elem.nodeType === 1 );
2007
2158
  return false;
2008
2159
  };
2009
- }),
2160
+ } ),
2010
2161
 
2011
2162
  // Miscellaneous
2012
2163
  "target": function( elem ) {
@@ -2019,7 +2170,9 @@ Expr = Sizzle.selectors = {
2019
2170
  },
2020
2171
 
2021
2172
  "focus": function( elem ) {
2022
- return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);
2173
+ return elem === document.activeElement &&
2174
+ ( !document.hasFocus || document.hasFocus() ) &&
2175
+ !!( elem.type || elem.href || ~elem.tabIndex );
2023
2176
  },
2024
2177
 
2025
2178
  // Boolean properties
@@ -2027,16 +2180,20 @@ Expr = Sizzle.selectors = {
2027
2180
  "disabled": createDisabledPseudo( true ),
2028
2181
 
2029
2182
  "checked": function( elem ) {
2183
+
2030
2184
  // In CSS3, :checked should return both checked and selected elements
2031
2185
  // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
2032
2186
  var nodeName = elem.nodeName.toLowerCase();
2033
- return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected);
2187
+ return ( nodeName === "input" && !!elem.checked ) ||
2188
+ ( nodeName === "option" && !!elem.selected );
2034
2189
  },
2035
2190
 
2036
2191
  "selected": function( elem ) {
2192
+
2037
2193
  // Accessing this property makes selected-by-default
2038
2194
  // options in Safari work properly
2039
2195
  if ( elem.parentNode ) {
2196
+ // eslint-disable-next-line no-unused-expressions
2040
2197
  elem.parentNode.selectedIndex;
2041
2198
  }
2042
2199
 
@@ -2045,6 +2202,7 @@ Expr = Sizzle.selectors = {
2045
2202
 
2046
2203
  // Contents
2047
2204
  "empty": function( elem ) {
2205
+
2048
2206
  // http://www.w3.org/TR/selectors/#empty-pseudo
2049
2207
  // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5),
2050
2208
  // but not by others (comment: 8; processing instruction: 7; etc.)
@@ -2058,7 +2216,7 @@ Expr = Sizzle.selectors = {
2058
2216
  },
2059
2217
 
2060
2218
  "parent": function( elem ) {
2061
- return !Expr.pseudos["empty"]( elem );
2219
+ return !Expr.pseudos[ "empty" ]( elem );
2062
2220
  },
2063
2221
 
2064
2222
  // Element/input types
@@ -2082,39 +2240,40 @@ Expr = Sizzle.selectors = {
2082
2240
 
2083
2241
  // Support: IE<8
2084
2242
  // New HTML5 attribute values (e.g., "search") appear with elem.type === "text"
2085
- ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text" );
2243
+ ( ( attr = elem.getAttribute( "type" ) ) == null ||
2244
+ attr.toLowerCase() === "text" );
2086
2245
  },
2087
2246
 
2088
2247
  // Position-in-collection
2089
- "first": createPositionalPseudo(function() {
2248
+ "first": createPositionalPseudo( function() {
2090
2249
  return [ 0 ];
2091
- }),
2250
+ } ),
2092
2251
 
2093
- "last": createPositionalPseudo(function( matchIndexes, length ) {
2252
+ "last": createPositionalPseudo( function( _matchIndexes, length ) {
2094
2253
  return [ length - 1 ];
2095
- }),
2254
+ } ),
2096
2255
 
2097
- "eq": createPositionalPseudo(function( matchIndexes, length, argument ) {
2256
+ "eq": createPositionalPseudo( function( _matchIndexes, length, argument ) {
2098
2257
  return [ argument < 0 ? argument + length : argument ];
2099
- }),
2258
+ } ),
2100
2259
 
2101
- "even": createPositionalPseudo(function( matchIndexes, length ) {
2260
+ "even": createPositionalPseudo( function( matchIndexes, length ) {
2102
2261
  var i = 0;
2103
2262
  for ( ; i < length; i += 2 ) {
2104
2263
  matchIndexes.push( i );
2105
2264
  }
2106
2265
  return matchIndexes;
2107
- }),
2266
+ } ),
2108
2267
 
2109
- "odd": createPositionalPseudo(function( matchIndexes, length ) {
2268
+ "odd": createPositionalPseudo( function( matchIndexes, length ) {
2110
2269
  var i = 1;
2111
2270
  for ( ; i < length; i += 2 ) {
2112
2271
  matchIndexes.push( i );
2113
2272
  }
2114
2273
  return matchIndexes;
2115
- }),
2274
+ } ),
2116
2275
 
2117
- "lt": createPositionalPseudo(function( matchIndexes, length, argument ) {
2276
+ "lt": createPositionalPseudo( function( matchIndexes, length, argument ) {
2118
2277
  var i = argument < 0 ?
2119
2278
  argument + length :
2120
2279
  argument > length ?
@@ -2124,19 +2283,19 @@ Expr = Sizzle.selectors = {
2124
2283
  matchIndexes.push( i );
2125
2284
  }
2126
2285
  return matchIndexes;
2127
- }),
2286
+ } ),
2128
2287
 
2129
- "gt": createPositionalPseudo(function( matchIndexes, length, argument ) {
2288
+ "gt": createPositionalPseudo( function( matchIndexes, length, argument ) {
2130
2289
  var i = argument < 0 ? argument + length : argument;
2131
2290
  for ( ; ++i < length; ) {
2132
2291
  matchIndexes.push( i );
2133
2292
  }
2134
2293
  return matchIndexes;
2135
- })
2294
+ } )
2136
2295
  }
2137
2296
  };
2138
2297
 
2139
- Expr.pseudos["nth"] = Expr.pseudos["eq"];
2298
+ Expr.pseudos[ "nth" ] = Expr.pseudos[ "eq" ];
2140
2299
 
2141
2300
  // Add button/input type pseudos
2142
2301
  for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) {
@@ -2167,37 +2326,39 @@ tokenize = Sizzle.tokenize = function( selector, parseOnly ) {
2167
2326
  while ( soFar ) {
2168
2327
 
2169
2328
  // Comma and first run
2170
- if ( !matched || (match = rcomma.exec( soFar )) ) {
2329
+ if ( !matched || ( match = rcomma.exec( soFar ) ) ) {
2171
2330
  if ( match ) {
2331
+
2172
2332
  // Don't consume trailing commas as valid
2173
- soFar = soFar.slice( match[0].length ) || soFar;
2333
+ soFar = soFar.slice( match[ 0 ].length ) || soFar;
2174
2334
  }
2175
- groups.push( (tokens = []) );
2335
+ groups.push( ( tokens = [] ) );
2176
2336
  }
2177
2337
 
2178
2338
  matched = false;
2179
2339
 
2180
2340
  // Combinators
2181
- if ( (match = rcombinators.exec( soFar )) ) {
2341
+ if ( ( match = rcombinators.exec( soFar ) ) ) {
2182
2342
  matched = match.shift();
2183
- tokens.push({
2343
+ tokens.push( {
2184
2344
  value: matched,
2345
+
2185
2346
  // Cast descendant combinators to space
2186
- type: match[0].replace( rtrim, " " )
2187
- });
2347
+ type: match[ 0 ].replace( rtrim, " " )
2348
+ } );
2188
2349
  soFar = soFar.slice( matched.length );
2189
2350
  }
2190
2351
 
2191
2352
  // Filters
2192
2353
  for ( type in Expr.filter ) {
2193
- if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] ||
2194
- (match = preFilters[ type ]( match ))) ) {
2354
+ if ( ( match = matchExpr[ type ].exec( soFar ) ) && ( !preFilters[ type ] ||
2355
+ ( match = preFilters[ type ]( match ) ) ) ) {
2195
2356
  matched = match.shift();
2196
- tokens.push({
2357
+ tokens.push( {
2197
2358
  value: matched,
2198
2359
  type: type,
2199
2360
  matches: match
2200
- });
2361
+ } );
2201
2362
  soFar = soFar.slice( matched.length );
2202
2363
  }
2203
2364
  }
@@ -2214,6 +2375,7 @@ tokenize = Sizzle.tokenize = function( selector, parseOnly ) {
2214
2375
  soFar.length :
2215
2376
  soFar ?
2216
2377
  Sizzle.error( selector ) :
2378
+
2217
2379
  // Cache the tokens
2218
2380
  tokenCache( selector, groups ).slice( 0 );
2219
2381
  };
@@ -2223,7 +2385,7 @@ function toSelector( tokens ) {
2223
2385
  len = tokens.length,
2224
2386
  selector = "";
2225
2387
  for ( ; i < len; i++ ) {
2226
- selector += tokens[i].value;
2388
+ selector += tokens[ i ].value;
2227
2389
  }
2228
2390
  return selector;
2229
2391
  }
@@ -2236,9 +2398,10 @@ function addCombinator( matcher, combinator, base ) {
2236
2398
  doneName = done++;
2237
2399
 
2238
2400
  return combinator.first ?
2401
+
2239
2402
  // Check against closest ancestor/preceding element
2240
2403
  function( elem, context, xml ) {
2241
- while ( (elem = elem[ dir ]) ) {
2404
+ while ( ( elem = elem[ dir ] ) ) {
2242
2405
  if ( elem.nodeType === 1 || checkNonElements ) {
2243
2406
  return matcher( elem, context, xml );
2244
2407
  }
@@ -2253,7 +2416,7 @@ function addCombinator( matcher, combinator, base ) {
2253
2416
 
2254
2417
  // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching
2255
2418
  if ( xml ) {
2256
- while ( (elem = elem[ dir ]) ) {
2419
+ while ( ( elem = elem[ dir ] ) ) {
2257
2420
  if ( elem.nodeType === 1 || checkNonElements ) {
2258
2421
  if ( matcher( elem, context, xml ) ) {
2259
2422
  return true;
@@ -2261,27 +2424,29 @@ function addCombinator( matcher, combinator, base ) {
2261
2424
  }
2262
2425
  }
2263
2426
  } else {
2264
- while ( (elem = elem[ dir ]) ) {
2427
+ while ( ( elem = elem[ dir ] ) ) {
2265
2428
  if ( elem.nodeType === 1 || checkNonElements ) {
2266
- outerCache = elem[ expando ] || (elem[ expando ] = {});
2429
+ outerCache = elem[ expando ] || ( elem[ expando ] = {} );
2267
2430
 
2268
2431
  // Support: IE <9 only
2269
2432
  // Defend against cloned attroperties (jQuery gh-1709)
2270
- uniqueCache = outerCache[ elem.uniqueID ] || (outerCache[ elem.uniqueID ] = {});
2433
+ uniqueCache = outerCache[ elem.uniqueID ] ||
2434
+ ( outerCache[ elem.uniqueID ] = {} );
2271
2435
 
2272
2436
  if ( skip && skip === elem.nodeName.toLowerCase() ) {
2273
2437
  elem = elem[ dir ] || elem;
2274
- } else if ( (oldCache = uniqueCache[ key ]) &&
2438
+ } else if ( ( oldCache = uniqueCache[ key ] ) &&
2275
2439
  oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) {
2276
2440
 
2277
2441
  // Assign to newCache so results back-propagate to previous elements
2278
- return (newCache[ 2 ] = oldCache[ 2 ]);
2442
+ return ( newCache[ 2 ] = oldCache[ 2 ] );
2279
2443
  } else {
2444
+
2280
2445
  // Reuse newcache so results back-propagate to previous elements
2281
2446
  uniqueCache[ key ] = newCache;
2282
2447
 
2283
2448
  // A match means we're done; a fail means we have to keep checking
2284
- if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) {
2449
+ if ( ( newCache[ 2 ] = matcher( elem, context, xml ) ) ) {
2285
2450
  return true;
2286
2451
  }
2287
2452
  }
@@ -2297,20 +2462,20 @@ function elementMatcher( matchers ) {
2297
2462
  function( elem, context, xml ) {
2298
2463
  var i = matchers.length;
2299
2464
  while ( i-- ) {
2300
- if ( !matchers[i]( elem, context, xml ) ) {
2465
+ if ( !matchers[ i ]( elem, context, xml ) ) {
2301
2466
  return false;
2302
2467
  }
2303
2468
  }
2304
2469
  return true;
2305
2470
  } :
2306
- matchers[0];
2471
+ matchers[ 0 ];
2307
2472
  }
2308
2473
 
2309
2474
  function multipleContexts( selector, contexts, results ) {
2310
2475
  var i = 0,
2311
2476
  len = contexts.length;
2312
2477
  for ( ; i < len; i++ ) {
2313
- Sizzle( selector, contexts[i], results );
2478
+ Sizzle( selector, contexts[ i ], results );
2314
2479
  }
2315
2480
  return results;
2316
2481
  }
@@ -2323,7 +2488,7 @@ function condense( unmatched, map, filter, context, xml ) {
2323
2488
  mapped = map != null;
2324
2489
 
2325
2490
  for ( ; i < len; i++ ) {
2326
- if ( (elem = unmatched[i]) ) {
2491
+ if ( ( elem = unmatched[ i ] ) ) {
2327
2492
  if ( !filter || filter( elem, context, xml ) ) {
2328
2493
  newUnmatched.push( elem );
2329
2494
  if ( mapped ) {
@@ -2343,14 +2508,18 @@ function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postS
2343
2508
  if ( postFinder && !postFinder[ expando ] ) {
2344
2509
  postFinder = setMatcher( postFinder, postSelector );
2345
2510
  }
2346
- return markFunction(function( seed, results, context, xml ) {
2511
+ return markFunction( function( seed, results, context, xml ) {
2347
2512
  var temp, i, elem,
2348
2513
  preMap = [],
2349
2514
  postMap = [],
2350
2515
  preexisting = results.length,
2351
2516
 
2352
2517
  // Get initial elements from seed or context
2353
- elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ),
2518
+ elems = seed || multipleContexts(
2519
+ selector || "*",
2520
+ context.nodeType ? [ context ] : context,
2521
+ []
2522
+ ),
2354
2523
 
2355
2524
  // Prefilter to get matcher input, preserving a map for seed-results synchronization
2356
2525
  matcherIn = preFilter && ( seed || !selector ) ?
@@ -2358,6 +2527,7 @@ function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postS
2358
2527
  elems,
2359
2528
 
2360
2529
  matcherOut = matcher ?
2530
+
2361
2531
  // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
2362
2532
  postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
2363
2533
 
@@ -2381,8 +2551,8 @@ function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postS
2381
2551
  // Un-match failing elements by moving them back to matcherIn
2382
2552
  i = temp.length;
2383
2553
  while ( i-- ) {
2384
- if ( (elem = temp[i]) ) {
2385
- matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem);
2554
+ if ( ( elem = temp[ i ] ) ) {
2555
+ matcherOut[ postMap[ i ] ] = !( matcherIn[ postMap[ i ] ] = elem );
2386
2556
  }
2387
2557
  }
2388
2558
  }
@@ -2390,25 +2560,27 @@ function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postS
2390
2560
  if ( seed ) {
2391
2561
  if ( postFinder || preFilter ) {
2392
2562
  if ( postFinder ) {
2563
+
2393
2564
  // Get the final matcherOut by condensing this intermediate into postFinder contexts
2394
2565
  temp = [];
2395
2566
  i = matcherOut.length;
2396
2567
  while ( i-- ) {
2397
- if ( (elem = matcherOut[i]) ) {
2568
+ if ( ( elem = matcherOut[ i ] ) ) {
2569
+
2398
2570
  // Restore matcherIn since elem is not yet a final match
2399
- temp.push( (matcherIn[i] = elem) );
2571
+ temp.push( ( matcherIn[ i ] = elem ) );
2400
2572
  }
2401
2573
  }
2402
- postFinder( null, (matcherOut = []), temp, xml );
2574
+ postFinder( null, ( matcherOut = [] ), temp, xml );
2403
2575
  }
2404
2576
 
2405
2577
  // Move matched elements from seed to results to keep them synchronized
2406
2578
  i = matcherOut.length;
2407
2579
  while ( i-- ) {
2408
- if ( (elem = matcherOut[i]) &&
2409
- (temp = postFinder ? indexOf( seed, elem ) : preMap[i]) > -1 ) {
2580
+ if ( ( elem = matcherOut[ i ] ) &&
2581
+ ( temp = postFinder ? indexOf( seed, elem ) : preMap[ i ] ) > -1 ) {
2410
2582
 
2411
- seed[temp] = !(results[temp] = elem);
2583
+ seed[ temp ] = !( results[ temp ] = elem );
2412
2584
  }
2413
2585
  }
2414
2586
  }
@@ -2426,14 +2598,14 @@ function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postS
2426
2598
  push.apply( results, matcherOut );
2427
2599
  }
2428
2600
  }
2429
- });
2601
+ } );
2430
2602
  }
2431
2603
 
2432
2604
  function matcherFromTokens( tokens ) {
2433
2605
  var checkContext, matcher, j,
2434
2606
  len = tokens.length,
2435
- leadingRelative = Expr.relative[ tokens[0].type ],
2436
- implicitRelative = leadingRelative || Expr.relative[" "],
2607
+ leadingRelative = Expr.relative[ tokens[ 0 ].type ],
2608
+ implicitRelative = leadingRelative || Expr.relative[ " " ],
2437
2609
  i = leadingRelative ? 1 : 0,
2438
2610
 
2439
2611
  // The foundational matcher ensures that elements are reachable from top-level context(s)
@@ -2445,38 +2617,43 @@ function matcherFromTokens( tokens ) {
2445
2617
  }, implicitRelative, true ),
2446
2618
  matchers = [ function( elem, context, xml ) {
2447
2619
  var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || (
2448
- (checkContext = context).nodeType ?
2620
+ ( checkContext = context ).nodeType ?
2449
2621
  matchContext( elem, context, xml ) :
2450
2622
  matchAnyContext( elem, context, xml ) );
2623
+
2451
2624
  // Avoid hanging onto element (issue #299)
2452
2625
  checkContext = null;
2453
2626
  return ret;
2454
2627
  } ];
2455
2628
 
2456
2629
  for ( ; i < len; i++ ) {
2457
- if ( (matcher = Expr.relative[ tokens[i].type ]) ) {
2458
- matchers = [ addCombinator(elementMatcher( matchers ), matcher) ];
2630
+ if ( ( matcher = Expr.relative[ tokens[ i ].type ] ) ) {
2631
+ matchers = [ addCombinator( elementMatcher( matchers ), matcher ) ];
2459
2632
  } else {
2460
- matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches );
2633
+ matcher = Expr.filter[ tokens[ i ].type ].apply( null, tokens[ i ].matches );
2461
2634
 
2462
2635
  // Return special upon seeing a positional matcher
2463
2636
  if ( matcher[ expando ] ) {
2637
+
2464
2638
  // Find the next relative operator (if any) for proper handling
2465
2639
  j = ++i;
2466
2640
  for ( ; j < len; j++ ) {
2467
- if ( Expr.relative[ tokens[j].type ] ) {
2641
+ if ( Expr.relative[ tokens[ j ].type ] ) {
2468
2642
  break;
2469
2643
  }
2470
2644
  }
2471
2645
  return setMatcher(
2472
2646
  i > 1 && elementMatcher( matchers ),
2473
2647
  i > 1 && toSelector(
2474
- // If the preceding token was a descendant combinator, insert an implicit any-element `*`
2475
- tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" })
2648
+
2649
+ // If the preceding token was a descendant combinator, insert an implicit any-element `*`
2650
+ tokens
2651
+ .slice( 0, i - 1 )
2652
+ .concat( { value: tokens[ i - 2 ].type === " " ? "*" : "" } )
2476
2653
  ).replace( rtrim, "$1" ),
2477
2654
  matcher,
2478
2655
  i < j && matcherFromTokens( tokens.slice( i, j ) ),
2479
- j < len && matcherFromTokens( (tokens = tokens.slice( j )) ),
2656
+ j < len && matcherFromTokens( ( tokens = tokens.slice( j ) ) ),
2480
2657
  j < len && toSelector( tokens )
2481
2658
  );
2482
2659
  }
@@ -2497,28 +2674,40 @@ function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
2497
2674
  unmatched = seed && [],
2498
2675
  setMatched = [],
2499
2676
  contextBackup = outermostContext,
2677
+
2500
2678
  // We must always have either seed elements or outermost context
2501
- elems = seed || byElement && Expr.find["TAG"]( "*", outermost ),
2679
+ elems = seed || byElement && Expr.find[ "TAG" ]( "*", outermost ),
2680
+
2502
2681
  // Use integer dirruns iff this is the outermost matcher
2503
- dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1),
2682
+ dirrunsUnique = ( dirruns += contextBackup == null ? 1 : Math.random() || 0.1 ),
2504
2683
  len = elems.length;
2505
2684
 
2506
2685
  if ( outermost ) {
2507
- outermostContext = context === document || context || outermost;
2686
+
2687
+ // Support: IE 11+, Edge 17 - 18+
2688
+ // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
2689
+ // two documents; shallow comparisons work.
2690
+ // eslint-disable-next-line eqeqeq
2691
+ outermostContext = context == document || context || outermost;
2508
2692
  }
2509
2693
 
2510
2694
  // Add elements passing elementMatchers directly to results
2511
2695
  // Support: IE<9, Safari
2512
2696
  // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id
2513
- for ( ; i !== len && (elem = elems[i]) != null; i++ ) {
2697
+ for ( ; i !== len && ( elem = elems[ i ] ) != null; i++ ) {
2514
2698
  if ( byElement && elem ) {
2515
2699
  j = 0;
2516
- if ( !context && elem.ownerDocument !== document ) {
2700
+
2701
+ // Support: IE 11+, Edge 17 - 18+
2702
+ // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
2703
+ // two documents; shallow comparisons work.
2704
+ // eslint-disable-next-line eqeqeq
2705
+ if ( !context && elem.ownerDocument != document ) {
2517
2706
  setDocument( elem );
2518
2707
  xml = !documentIsHTML;
2519
2708
  }
2520
- while ( (matcher = elementMatchers[j++]) ) {
2521
- if ( matcher( elem, context || document, xml) ) {
2709
+ while ( ( matcher = elementMatchers[ j++ ] ) ) {
2710
+ if ( matcher( elem, context || document, xml ) ) {
2522
2711
  results.push( elem );
2523
2712
  break;
2524
2713
  }
@@ -2530,8 +2719,9 @@ function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
2530
2719
 
2531
2720
  // Track unmatched elements for set filters
2532
2721
  if ( bySet ) {
2722
+
2533
2723
  // They will have gone through all possible matchers
2534
- if ( (elem = !matcher && elem) ) {
2724
+ if ( ( elem = !matcher && elem ) ) {
2535
2725
  matchedCount--;
2536
2726
  }
2537
2727
 
@@ -2555,16 +2745,17 @@ function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
2555
2745
  // numerically zero.
2556
2746
  if ( bySet && i !== matchedCount ) {
2557
2747
  j = 0;
2558
- while ( (matcher = setMatchers[j++]) ) {
2748
+ while ( ( matcher = setMatchers[ j++ ] ) ) {
2559
2749
  matcher( unmatched, setMatched, context, xml );
2560
2750
  }
2561
2751
 
2562
2752
  if ( seed ) {
2753
+
2563
2754
  // Reintegrate element matches to eliminate the need for sorting
2564
2755
  if ( matchedCount > 0 ) {
2565
2756
  while ( i-- ) {
2566
- if ( !(unmatched[i] || setMatched[i]) ) {
2567
- setMatched[i] = pop.call( results );
2757
+ if ( !( unmatched[ i ] || setMatched[ i ] ) ) {
2758
+ setMatched[ i ] = pop.call( results );
2568
2759
  }
2569
2760
  }
2570
2761
  }
@@ -2605,13 +2796,14 @@ compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) {
2605
2796
  cached = compilerCache[ selector + " " ];
2606
2797
 
2607
2798
  if ( !cached ) {
2799
+
2608
2800
  // Generate a function of recursive functions that can be used to check each element
2609
2801
  if ( !match ) {
2610
2802
  match = tokenize( selector );
2611
2803
  }
2612
2804
  i = match.length;
2613
2805
  while ( i-- ) {
2614
- cached = matcherFromTokens( match[i] );
2806
+ cached = matcherFromTokens( match[ i ] );
2615
2807
  if ( cached[ expando ] ) {
2616
2808
  setMatchers.push( cached );
2617
2809
  } else {
@@ -2620,7 +2812,10 @@ compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) {
2620
2812
  }
2621
2813
 
2622
2814
  // Cache the compiled function
2623
- cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) );
2815
+ cached = compilerCache(
2816
+ selector,
2817
+ matcherFromGroupMatchers( elementMatchers, setMatchers )
2818
+ );
2624
2819
 
2625
2820
  // Save selector and tokenization
2626
2821
  cached.selector = selector;
@@ -2640,7 +2835,7 @@ compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) {
2640
2835
  select = Sizzle.select = function( selector, context, results, seed ) {
2641
2836
  var i, tokens, token, type, find,
2642
2837
  compiled = typeof selector === "function" && selector,
2643
- match = !seed && tokenize( (selector = compiled.selector || selector) );
2838
+ match = !seed && tokenize( ( selector = compiled.selector || selector ) );
2644
2839
 
2645
2840
  results = results || [];
2646
2841
 
@@ -2649,11 +2844,12 @@ select = Sizzle.select = function( selector, context, results, seed ) {
2649
2844
  if ( match.length === 1 ) {
2650
2845
 
2651
2846
  // Reduce context if the leading compound selector is an ID
2652
- tokens = match[0] = match[0].slice( 0 );
2653
- if ( tokens.length > 2 && (token = tokens[0]).type === "ID" &&
2654
- context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[1].type ] ) {
2847
+ tokens = match[ 0 ] = match[ 0 ].slice( 0 );
2848
+ if ( tokens.length > 2 && ( token = tokens[ 0 ] ).type === "ID" &&
2849
+ context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[ 1 ].type ] ) {
2655
2850
 
2656
- context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0];
2851
+ context = ( Expr.find[ "ID" ]( token.matches[ 0 ]
2852
+ .replace( runescape, funescape ), context ) || [] )[ 0 ];
2657
2853
  if ( !context ) {
2658
2854
  return results;
2659
2855
 
@@ -2666,20 +2862,22 @@ select = Sizzle.select = function( selector, context, results, seed ) {
2666
2862
  }
2667
2863
 
2668
2864
  // Fetch a seed set for right-to-left matching
2669
- i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length;
2865
+ i = matchExpr[ "needsContext" ].test( selector ) ? 0 : tokens.length;
2670
2866
  while ( i-- ) {
2671
- token = tokens[i];
2867
+ token = tokens[ i ];
2672
2868
 
2673
2869
  // Abort if we hit a combinator
2674
- if ( Expr.relative[ (type = token.type) ] ) {
2870
+ if ( Expr.relative[ ( type = token.type ) ] ) {
2675
2871
  break;
2676
2872
  }
2677
- if ( (find = Expr.find[ type ]) ) {
2873
+ if ( ( find = Expr.find[ type ] ) ) {
2874
+
2678
2875
  // Search, expanding context for leading sibling combinators
2679
- if ( (seed = find(
2680
- token.matches[0].replace( runescape, funescape ),
2681
- rsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context
2682
- )) ) {
2876
+ if ( ( seed = find(
2877
+ token.matches[ 0 ].replace( runescape, funescape ),
2878
+ rsibling.test( tokens[ 0 ].type ) && testContext( context.parentNode ) ||
2879
+ context
2880
+ ) ) ) {
2683
2881
 
2684
2882
  // If seed is empty or no tokens remain, we can return early
2685
2883
  tokens.splice( i, 1 );
@@ -2710,7 +2908,7 @@ select = Sizzle.select = function( selector, context, results, seed ) {
2710
2908
  // One-time assignments
2711
2909
 
2712
2910
  // Sort stability
2713
- support.sortStable = expando.split("").sort( sortOrder ).join("") === expando;
2911
+ support.sortStable = expando.split( "" ).sort( sortOrder ).join( "" ) === expando;
2714
2912
 
2715
2913
  // Support: Chrome 14-35+
2716
2914
  // Always assume duplicates if they aren't passed to the comparison function
@@ -2721,58 +2919,59 @@ setDocument();
2721
2919
 
2722
2920
  // Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27)
2723
2921
  // Detached nodes confoundingly follow *each other*
2724
- support.sortDetached = assert(function( el ) {
2922
+ support.sortDetached = assert( function( el ) {
2923
+
2725
2924
  // Should return 1, but returns 4 (following)
2726
- return el.compareDocumentPosition( document.createElement("fieldset") ) & 1;
2727
- });
2925
+ return el.compareDocumentPosition( document.createElement( "fieldset" ) ) & 1;
2926
+ } );
2728
2927
 
2729
2928
  // Support: IE<8
2730
2929
  // Prevent attribute/property "interpolation"
2731
2930
  // https://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
2732
- if ( !assert(function( el ) {
2931
+ if ( !assert( function( el ) {
2733
2932
  el.innerHTML = "<a href='#'></a>";
2734
- return el.firstChild.getAttribute("href") === "#" ;
2735
- }) ) {
2933
+ return el.firstChild.getAttribute( "href" ) === "#";
2934
+ } ) ) {
2736
2935
  addHandle( "type|href|height|width", function( elem, name, isXML ) {
2737
2936
  if ( !isXML ) {
2738
2937
  return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 );
2739
2938
  }
2740
- });
2939
+ } );
2741
2940
  }
2742
2941
 
2743
2942
  // Support: IE<9
2744
2943
  // Use defaultValue in place of getAttribute("value")
2745
- if ( !support.attributes || !assert(function( el ) {
2944
+ if ( !support.attributes || !assert( function( el ) {
2746
2945
  el.innerHTML = "<input/>";
2747
2946
  el.firstChild.setAttribute( "value", "" );
2748
2947
  return el.firstChild.getAttribute( "value" ) === "";
2749
- }) ) {
2750
- addHandle( "value", function( elem, name, isXML ) {
2948
+ } ) ) {
2949
+ addHandle( "value", function( elem, _name, isXML ) {
2751
2950
  if ( !isXML && elem.nodeName.toLowerCase() === "input" ) {
2752
2951
  return elem.defaultValue;
2753
2952
  }
2754
- });
2953
+ } );
2755
2954
  }
2756
2955
 
2757
2956
  // Support: IE<9
2758
2957
  // Use getAttributeNode to fetch booleans when getAttribute lies
2759
- if ( !assert(function( el ) {
2760
- return el.getAttribute("disabled") == null;
2761
- }) ) {
2958
+ if ( !assert( function( el ) {
2959
+ return el.getAttribute( "disabled" ) == null;
2960
+ } ) ) {
2762
2961
  addHandle( booleans, function( elem, name, isXML ) {
2763
2962
  var val;
2764
2963
  if ( !isXML ) {
2765
2964
  return elem[ name ] === true ? name.toLowerCase() :
2766
- (val = elem.getAttributeNode( name )) && val.specified ?
2965
+ ( val = elem.getAttributeNode( name ) ) && val.specified ?
2767
2966
  val.value :
2768
- null;
2967
+ null;
2769
2968
  }
2770
- });
2969
+ } );
2771
2970
  }
2772
2971
 
2773
2972
  return Sizzle;
2774
2973
 
2775
- })( window );
2974
+ } )( window );
2776
2975
 
2777
2976
 
2778
2977
 
@@ -3141,7 +3340,7 @@ jQuery.each( {
3141
3340
  parents: function( elem ) {
3142
3341
  return dir( elem, "parentNode" );
3143
3342
  },
3144
- parentsUntil: function( elem, i, until ) {
3343
+ parentsUntil: function( elem, _i, until ) {
3145
3344
  return dir( elem, "parentNode", until );
3146
3345
  },
3147
3346
  next: function( elem ) {
@@ -3156,10 +3355,10 @@ jQuery.each( {
3156
3355
  prevAll: function( elem ) {
3157
3356
  return dir( elem, "previousSibling" );
3158
3357
  },
3159
- nextUntil: function( elem, i, until ) {
3358
+ nextUntil: function( elem, _i, until ) {
3160
3359
  return dir( elem, "nextSibling", until );
3161
3360
  },
3162
- prevUntil: function( elem, i, until ) {
3361
+ prevUntil: function( elem, _i, until ) {
3163
3362
  return dir( elem, "previousSibling", until );
3164
3363
  },
3165
3364
  siblings: function( elem ) {
@@ -3169,7 +3368,13 @@ jQuery.each( {
3169
3368
  return siblings( elem.firstChild );
3170
3369
  },
3171
3370
  contents: function( elem ) {
3172
- if ( typeof elem.contentDocument !== "undefined" ) {
3371
+ if ( elem.contentDocument != null &&
3372
+
3373
+ // Support: IE 11+
3374
+ // <object> elements with no `data` attribute has an object
3375
+ // `contentDocument` with a `null` prototype.
3376
+ getProto( elem.contentDocument ) ) {
3377
+
3173
3378
  return elem.contentDocument;
3174
3379
  }
3175
3380
 
@@ -3512,7 +3717,7 @@ jQuery.extend( {
3512
3717
  var fns = arguments;
3513
3718
 
3514
3719
  return jQuery.Deferred( function( newDefer ) {
3515
- jQuery.each( tuples, function( i, tuple ) {
3720
+ jQuery.each( tuples, function( _i, tuple ) {
3516
3721
 
3517
3722
  // Map tuples (progress, done, fail) to arguments (done, fail, progress)
3518
3723
  var fn = isFunction( fns[ tuple[ 4 ] ] ) && fns[ tuple[ 4 ] ];
@@ -3965,7 +4170,7 @@ var access = function( elems, fn, key, value, chainable, emptyGet, raw ) {
3965
4170
  // ...except when executing function values
3966
4171
  } else {
3967
4172
  bulk = fn;
3968
- fn = function( elem, key, value ) {
4173
+ fn = function( elem, _key, value ) {
3969
4174
  return bulk.call( jQuery( elem ), value );
3970
4175
  };
3971
4176
  }
@@ -4000,7 +4205,7 @@ var rmsPrefix = /^-ms-/,
4000
4205
  rdashAlpha = /-([a-z])/g;
4001
4206
 
4002
4207
  // Used by camelCase as callback to replace()
4003
- function fcamelCase( all, letter ) {
4208
+ function fcamelCase( _all, letter ) {
4004
4209
  return letter.toUpperCase();
4005
4210
  }
4006
4211
 
@@ -4498,8 +4703,12 @@ var documentElement = document.documentElement;
4498
4703
  },
4499
4704
  composed = { composed: true };
4500
4705
 
4706
+ // Support: IE 9 - 11+, Edge 12 - 18+, iOS 10.0 - 10.2 only
4501
4707
  // Check attachment across shadow DOM boundaries when possible (gh-3504)
4502
- if ( documentElement.attachShadow ) {
4708
+ // Support: iOS 10.0-10.2 only
4709
+ // Early iOS 10 versions support `attachShadow` but not `getRootNode`,
4710
+ // leading to errors. We need to check for `getRootNode`.
4711
+ if ( documentElement.getRootNode ) {
4503
4712
  isAttached = function( elem ) {
4504
4713
  return jQuery.contains( elem.ownerDocument, elem ) ||
4505
4714
  elem.getRootNode( composed ) === elem.ownerDocument;
@@ -4524,27 +4733,6 @@ var isHiddenWithinTree = function( elem, el ) {
4524
4733
  jQuery.css( elem, "display" ) === "none";
4525
4734
  };
4526
4735
 
4527
- var swap = function( elem, options, callback, args ) {
4528
- var ret, name,
4529
- old = {};
4530
-
4531
- // Remember the old values, and insert the new ones
4532
- for ( name in options ) {
4533
- old[ name ] = elem.style[ name ];
4534
- elem.style[ name ] = options[ name ];
4535
- }
4536
-
4537
- ret = callback.apply( elem, args || [] );
4538
-
4539
- // Revert the old values
4540
- for ( name in options ) {
4541
- elem.style[ name ] = old[ name ];
4542
- }
4543
-
4544
- return ret;
4545
- };
4546
-
4547
-
4548
4736
 
4549
4737
 
4550
4738
  function adjustCSS( elem, prop, valueParts, tween ) {
@@ -4715,11 +4903,40 @@ var rscriptType = ( /^$|^module$|\/(?:java|ecma)script/i );
4715
4903
 
4716
4904
 
4717
4905
 
4718
- // We have to close these tags to support XHTML (#13200)
4719
- var wrapMap = {
4906
+ ( function() {
4907
+ var fragment = document.createDocumentFragment(),
4908
+ div = fragment.appendChild( document.createElement( "div" ) ),
4909
+ input = document.createElement( "input" );
4910
+
4911
+ // Support: Android 4.0 - 4.3 only
4912
+ // Check state lost if the name is set (#11217)
4913
+ // Support: Windows Web Apps (WWA)
4914
+ // `name` and `type` must use .setAttribute for WWA (#14901)
4915
+ input.setAttribute( "type", "radio" );
4916
+ input.setAttribute( "checked", "checked" );
4917
+ input.setAttribute( "name", "t" );
4918
+
4919
+ div.appendChild( input );
4920
+
4921
+ // Support: Android <=4.1 only
4922
+ // Older WebKit doesn't clone checked state correctly in fragments
4923
+ support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked;
4924
+
4925
+ // Support: IE <=11 only
4926
+ // Make sure textarea (and checkbox) defaultValue is properly cloned
4927
+ div.innerHTML = "<textarea>x</textarea>";
4928
+ support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue;
4720
4929
 
4721
4930
  // Support: IE <=9 only
4722
- option: [ 1, "<select multiple='multiple'>", "</select>" ],
4931
+ // IE <=9 replaces <option> tags with their contents when inserted outside of
4932
+ // the select element.
4933
+ div.innerHTML = "<option></option>";
4934
+ support.option = !!div.lastChild;
4935
+ } )();
4936
+
4937
+
4938
+ // We have to close these tags to support XHTML (#13200)
4939
+ var wrapMap = {
4723
4940
 
4724
4941
  // XHTML parsers do not magically insert elements in the
4725
4942
  // same way that tag soup parsers do. So we cannot shorten
@@ -4732,12 +4949,14 @@ var wrapMap = {
4732
4949
  _default: [ 0, "", "" ]
4733
4950
  };
4734
4951
 
4735
- // Support: IE <=9 only
4736
- wrapMap.optgroup = wrapMap.option;
4737
-
4738
4952
  wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
4739
4953
  wrapMap.th = wrapMap.td;
4740
4954
 
4955
+ // Support: IE <=9 only
4956
+ if ( !support.option ) {
4957
+ wrapMap.optgroup = wrapMap.option = [ 1, "<select multiple='multiple'>", "</select>" ];
4958
+ }
4959
+
4741
4960
 
4742
4961
  function getAll( context, tag ) {
4743
4962
 
@@ -4870,32 +5089,6 @@ function buildFragment( elems, context, scripts, selection, ignored ) {
4870
5089
  }
4871
5090
 
4872
5091
 
4873
- ( function() {
4874
- var fragment = document.createDocumentFragment(),
4875
- div = fragment.appendChild( document.createElement( "div" ) ),
4876
- input = document.createElement( "input" );
4877
-
4878
- // Support: Android 4.0 - 4.3 only
4879
- // Check state lost if the name is set (#11217)
4880
- // Support: Windows Web Apps (WWA)
4881
- // `name` and `type` must use .setAttribute for WWA (#14901)
4882
- input.setAttribute( "type", "radio" );
4883
- input.setAttribute( "checked", "checked" );
4884
- input.setAttribute( "name", "t" );
4885
-
4886
- div.appendChild( input );
4887
-
4888
- // Support: Android <=4.1 only
4889
- // Older WebKit doesn't clone checked state correctly in fragments
4890
- support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked;
4891
-
4892
- // Support: IE <=11 only
4893
- // Make sure textarea (and checkbox) defaultValue is properly cloned
4894
- div.innerHTML = "<textarea>x</textarea>";
4895
- support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue;
4896
- } )();
4897
-
4898
-
4899
5092
  var
4900
5093
  rkeyEvent = /^key/,
4901
5094
  rmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/,
@@ -5004,8 +5197,8 @@ jQuery.event = {
5004
5197
  special, handlers, type, namespaces, origType,
5005
5198
  elemData = dataPriv.get( elem );
5006
5199
 
5007
- // Don't attach events to noData or text/comment nodes (but allow plain objects)
5008
- if ( !elemData ) {
5200
+ // Only attach events to objects that accept data
5201
+ if ( !acceptData( elem ) ) {
5009
5202
  return;
5010
5203
  }
5011
5204
 
@@ -5029,7 +5222,7 @@ jQuery.event = {
5029
5222
 
5030
5223
  // Init the element's event structure and main handler, if this is the first
5031
5224
  if ( !( events = elemData.events ) ) {
5032
- events = elemData.events = {};
5225
+ events = elemData.events = Object.create( null );
5033
5226
  }
5034
5227
  if ( !( eventHandle = elemData.handle ) ) {
5035
5228
  eventHandle = elemData.handle = function( e ) {
@@ -5187,12 +5380,15 @@ jQuery.event = {
5187
5380
 
5188
5381
  dispatch: function( nativeEvent ) {
5189
5382
 
5190
- // Make a writable jQuery.Event from the native event object
5191
- var event = jQuery.event.fix( nativeEvent );
5192
-
5193
5383
  var i, j, ret, matched, handleObj, handlerQueue,
5194
5384
  args = new Array( arguments.length ),
5195
- handlers = ( dataPriv.get( this, "events" ) || {} )[ event.type ] || [],
5385
+
5386
+ // Make a writable jQuery.Event from the native event object
5387
+ event = jQuery.event.fix( nativeEvent ),
5388
+
5389
+ handlers = (
5390
+ dataPriv.get( this, "events" ) || Object.create( null )
5391
+ )[ event.type ] || [],
5196
5392
  special = jQuery.event.special[ event.type ] || {};
5197
5393
 
5198
5394
  // Use the fix-ed jQuery.Event rather than the (read-only) native event
@@ -5359,8 +5555,7 @@ jQuery.event = {
5359
5555
 
5360
5556
  // Claim the first handler
5361
5557
  if ( rcheckableType.test( el.type ) &&
5362
- el.click && nodeName( el, "input" ) &&
5363
- dataPriv.get( el, "click" ) === undefined ) {
5558
+ el.click && nodeName( el, "input" ) ) {
5364
5559
 
5365
5560
  // dataPriv.set( el, "click", ... )
5366
5561
  leverageNative( el, "click", returnTrue );
@@ -5377,8 +5572,7 @@ jQuery.event = {
5377
5572
 
5378
5573
  // Force setup before triggering a click
5379
5574
  if ( rcheckableType.test( el.type ) &&
5380
- el.click && nodeName( el, "input" ) &&
5381
- dataPriv.get( el, "click" ) === undefined ) {
5575
+ el.click && nodeName( el, "input" ) ) {
5382
5576
 
5383
5577
  leverageNative( el, "click" );
5384
5578
  }
@@ -5419,7 +5613,9 @@ function leverageNative( el, type, expectSync ) {
5419
5613
 
5420
5614
  // Missing expectSync indicates a trigger call, which must force setup through jQuery.event.add
5421
5615
  if ( !expectSync ) {
5422
- jQuery.event.add( el, type, returnTrue );
5616
+ if ( dataPriv.get( el, type ) === undefined ) {
5617
+ jQuery.event.add( el, type, returnTrue );
5618
+ }
5423
5619
  return;
5424
5620
  }
5425
5621
 
@@ -5434,9 +5630,13 @@ function leverageNative( el, type, expectSync ) {
5434
5630
  if ( ( event.isTrigger & 1 ) && this[ type ] ) {
5435
5631
 
5436
5632
  // Interrupt processing of the outer synthetic .trigger()ed event
5437
- if ( !saved ) {
5633
+ // Saved data should be false in such cases, but might be a leftover capture object
5634
+ // from an async native handler (gh-4350)
5635
+ if ( !saved.length ) {
5438
5636
 
5439
5637
  // Store arguments for use when handling the inner native event
5638
+ // There will always be at least one argument (an event object), so this array
5639
+ // will not be confused with a leftover capture object.
5440
5640
  saved = slice.call( arguments );
5441
5641
  dataPriv.set( this, type, saved );
5442
5642
 
@@ -5449,14 +5649,14 @@ function leverageNative( el, type, expectSync ) {
5449
5649
  if ( saved !== result || notAsync ) {
5450
5650
  dataPriv.set( this, type, false );
5451
5651
  } else {
5452
- result = undefined;
5652
+ result = {};
5453
5653
  }
5454
5654
  if ( saved !== result ) {
5455
5655
 
5456
5656
  // Cancel the outer synthetic event
5457
5657
  event.stopImmediatePropagation();
5458
5658
  event.preventDefault();
5459
- return result;
5659
+ return result.value;
5460
5660
  }
5461
5661
 
5462
5662
  // If this is an inner synthetic event for an event with a bubbling surrogate
@@ -5471,17 +5671,19 @@ function leverageNative( el, type, expectSync ) {
5471
5671
 
5472
5672
  // If this is a native event triggered above, everything is now in order
5473
5673
  // Fire an inner synthetic event with the original arguments
5474
- } else if ( saved ) {
5674
+ } else if ( saved.length ) {
5475
5675
 
5476
5676
  // ...and capture the result
5477
- dataPriv.set( this, type, jQuery.event.trigger(
5478
-
5479
- // Support: IE <=9 - 11+
5480
- // Extend with the prototype to reset the above stopImmediatePropagation()
5481
- jQuery.extend( saved.shift(), jQuery.Event.prototype ),
5482
- saved,
5483
- this
5484
- ) );
5677
+ dataPriv.set( this, type, {
5678
+ value: jQuery.event.trigger(
5679
+
5680
+ // Support: IE <=9 - 11+
5681
+ // Extend with the prototype to reset the above stopImmediatePropagation()
5682
+ jQuery.extend( saved[ 0 ], jQuery.Event.prototype ),
5683
+ saved.slice( 1 ),
5684
+ this
5685
+ )
5686
+ } );
5485
5687
 
5486
5688
  // Abort handling of the native event
5487
5689
  event.stopImmediatePropagation();
@@ -5761,13 +5963,6 @@ jQuery.fn.extend( {
5761
5963
 
5762
5964
  var
5763
5965
 
5764
- /* eslint-disable max-len */
5765
-
5766
- // See https://github.com/eslint/eslint/issues/3229
5767
- rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi,
5768
-
5769
- /* eslint-enable */
5770
-
5771
5966
  // Support: IE <=10 - 11, Edge 12 - 13 only
5772
5967
  // In IE/Edge using regex groups here causes severe slowdowns.
5773
5968
  // See https://connect.microsoft.com/IE/feedback/details/1736512/
@@ -5804,7 +5999,7 @@ function restoreScript( elem ) {
5804
5999
  }
5805
6000
 
5806
6001
  function cloneCopyEvent( src, dest ) {
5807
- var i, l, type, pdataOld, pdataCur, udataOld, udataCur, events;
6002
+ var i, l, type, pdataOld, udataOld, udataCur, events;
5808
6003
 
5809
6004
  if ( dest.nodeType !== 1 ) {
5810
6005
  return;
@@ -5812,13 +6007,11 @@ function cloneCopyEvent( src, dest ) {
5812
6007
 
5813
6008
  // 1. Copy private data: events, handlers, etc.
5814
6009
  if ( dataPriv.hasData( src ) ) {
5815
- pdataOld = dataPriv.access( src );
5816
- pdataCur = dataPriv.set( dest, pdataOld );
6010
+ pdataOld = dataPriv.get( src );
5817
6011
  events = pdataOld.events;
5818
6012
 
5819
6013
  if ( events ) {
5820
- delete pdataCur.handle;
5821
- pdataCur.events = {};
6014
+ dataPriv.remove( dest, "handle events" );
5822
6015
 
5823
6016
  for ( type in events ) {
5824
6017
  for ( i = 0, l = events[ type ].length; i < l; i++ ) {
@@ -5854,7 +6047,7 @@ function fixInput( src, dest ) {
5854
6047
  function domManip( collection, args, callback, ignored ) {
5855
6048
 
5856
6049
  // Flatten any nested arrays
5857
- args = concat.apply( [], args );
6050
+ args = flat( args );
5858
6051
 
5859
6052
  var fragment, first, scripts, hasScripts, node, doc,
5860
6053
  i = 0,
@@ -5929,7 +6122,7 @@ function domManip( collection, args, callback, ignored ) {
5929
6122
  if ( jQuery._evalUrl && !node.noModule ) {
5930
6123
  jQuery._evalUrl( node.src, {
5931
6124
  nonce: node.nonce || node.getAttribute( "nonce" )
5932
- } );
6125
+ }, doc );
5933
6126
  }
5934
6127
  } else {
5935
6128
  DOMEval( node.textContent.replace( rcleanScript, "" ), node, doc );
@@ -5966,7 +6159,7 @@ function remove( elem, selector, keepData ) {
5966
6159
 
5967
6160
  jQuery.extend( {
5968
6161
  htmlPrefilter: function( html ) {
5969
- return html.replace( rxhtmlTag, "<$1></$2>" );
6162
+ return html;
5970
6163
  },
5971
6164
 
5972
6165
  clone: function( elem, dataAndEvents, deepDataAndEvents ) {
@@ -6228,6 +6421,27 @@ var getStyles = function( elem ) {
6228
6421
  return view.getComputedStyle( elem );
6229
6422
  };
6230
6423
 
6424
+ var swap = function( elem, options, callback ) {
6425
+ var ret, name,
6426
+ old = {};
6427
+
6428
+ // Remember the old values, and insert the new ones
6429
+ for ( name in options ) {
6430
+ old[ name ] = elem.style[ name ];
6431
+ elem.style[ name ] = options[ name ];
6432
+ }
6433
+
6434
+ ret = callback.call( elem );
6435
+
6436
+ // Revert the old values
6437
+ for ( name in options ) {
6438
+ elem.style[ name ] = old[ name ];
6439
+ }
6440
+
6441
+ return ret;
6442
+ };
6443
+
6444
+
6231
6445
  var rboxStyle = new RegExp( cssExpand.join( "|" ), "i" );
6232
6446
 
6233
6447
 
@@ -6285,7 +6499,7 @@ var rboxStyle = new RegExp( cssExpand.join( "|" ), "i" );
6285
6499
  }
6286
6500
 
6287
6501
  var pixelPositionVal, boxSizingReliableVal, scrollboxSizeVal, pixelBoxStylesVal,
6288
- reliableMarginLeftVal,
6502
+ reliableTrDimensionsVal, reliableMarginLeftVal,
6289
6503
  container = document.createElement( "div" ),
6290
6504
  div = document.createElement( "div" );
6291
6505
 
@@ -6320,6 +6534,35 @@ var rboxStyle = new RegExp( cssExpand.join( "|" ), "i" );
6320
6534
  scrollboxSize: function() {
6321
6535
  computeStyleTests();
6322
6536
  return scrollboxSizeVal;
6537
+ },
6538
+
6539
+ // Support: IE 9 - 11+, Edge 15 - 18+
6540
+ // IE/Edge misreport `getComputedStyle` of table rows with width/height
6541
+ // set in CSS while `offset*` properties report correct values.
6542
+ // Behavior in IE 9 is more subtle than in newer versions & it passes
6543
+ // some versions of this test; make sure not to make it pass there!
6544
+ reliableTrDimensions: function() {
6545
+ var table, tr, trChild, trStyle;
6546
+ if ( reliableTrDimensionsVal == null ) {
6547
+ table = document.createElement( "table" );
6548
+ tr = document.createElement( "tr" );
6549
+ trChild = document.createElement( "div" );
6550
+
6551
+ table.style.cssText = "position:absolute;left:-11111px";
6552
+ tr.style.height = "1px";
6553
+ trChild.style.height = "9px";
6554
+
6555
+ documentElement
6556
+ .appendChild( table )
6557
+ .appendChild( tr )
6558
+ .appendChild( trChild );
6559
+
6560
+ trStyle = window.getComputedStyle( tr );
6561
+ reliableTrDimensionsVal = parseInt( trStyle.height ) > 3;
6562
+
6563
+ documentElement.removeChild( table );
6564
+ }
6565
+ return reliableTrDimensionsVal;
6323
6566
  }
6324
6567
  } );
6325
6568
  } )();
@@ -6444,7 +6687,7 @@ var
6444
6687
  fontWeight: "400"
6445
6688
  };
6446
6689
 
6447
- function setPositiveNumber( elem, value, subtract ) {
6690
+ function setPositiveNumber( _elem, value, subtract ) {
6448
6691
 
6449
6692
  // Any relative (+/-) values have already been
6450
6693
  // normalized at this point
@@ -6549,17 +6792,26 @@ function getWidthOrHeight( elem, dimension, extra ) {
6549
6792
  }
6550
6793
 
6551
6794
 
6552
- // Fall back to offsetWidth/offsetHeight when value is "auto"
6553
- // This happens for inline elements with no explicit setting (gh-3571)
6554
- // Support: Android <=4.1 - 4.3 only
6555
- // Also use offsetWidth/offsetHeight for misreported inline dimensions (gh-3602)
6556
- // Support: IE 9-11 only
6557
- // Also use offsetWidth/offsetHeight for when box sizing is unreliable
6558
- // We use getClientRects() to check for hidden/disconnected.
6559
- // In those cases, the computed value can be trusted to be border-box
6795
+ // Support: IE 9 - 11 only
6796
+ // Use offsetWidth/offsetHeight for when box sizing is unreliable.
6797
+ // In those cases, the computed value can be trusted to be border-box.
6560
6798
  if ( ( !support.boxSizingReliable() && isBorderBox ||
6799
+
6800
+ // Support: IE 10 - 11+, Edge 15 - 18+
6801
+ // IE/Edge misreport `getComputedStyle` of table rows with width/height
6802
+ // set in CSS while `offset*` properties report correct values.
6803
+ // Interestingly, in some cases IE 9 doesn't suffer from this issue.
6804
+ !support.reliableTrDimensions() && nodeName( elem, "tr" ) ||
6805
+
6806
+ // Fall back to offsetWidth/offsetHeight when value is "auto"
6807
+ // This happens for inline elements with no explicit setting (gh-3571)
6561
6808
  val === "auto" ||
6809
+
6810
+ // Support: Android <=4.1 - 4.3 only
6811
+ // Also use offsetWidth/offsetHeight for misreported inline dimensions (gh-3602)
6562
6812
  !parseFloat( val ) && jQuery.css( elem, "display", false, styles ) === "inline" ) &&
6813
+
6814
+ // Make sure the element is visible & connected
6563
6815
  elem.getClientRects().length ) {
6564
6816
 
6565
6817
  isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box";
@@ -6754,7 +7006,7 @@ jQuery.extend( {
6754
7006
  }
6755
7007
  } );
6756
7008
 
6757
- jQuery.each( [ "height", "width" ], function( i, dimension ) {
7009
+ jQuery.each( [ "height", "width" ], function( _i, dimension ) {
6758
7010
  jQuery.cssHooks[ dimension ] = {
6759
7011
  get: function( elem, computed, extra ) {
6760
7012
  if ( computed ) {
@@ -7527,7 +7779,7 @@ jQuery.fn.extend( {
7527
7779
  clearQueue = type;
7528
7780
  type = undefined;
7529
7781
  }
7530
- if ( clearQueue && type !== false ) {
7782
+ if ( clearQueue ) {
7531
7783
  this.queue( type || "fx", [] );
7532
7784
  }
7533
7785
 
@@ -7610,7 +7862,7 @@ jQuery.fn.extend( {
7610
7862
  }
7611
7863
  } );
7612
7864
 
7613
- jQuery.each( [ "toggle", "show", "hide" ], function( i, name ) {
7865
+ jQuery.each( [ "toggle", "show", "hide" ], function( _i, name ) {
7614
7866
  var cssFn = jQuery.fn[ name ];
7615
7867
  jQuery.fn[ name ] = function( speed, easing, callback ) {
7616
7868
  return speed == null || typeof speed === "boolean" ?
@@ -7831,7 +8083,7 @@ boolHook = {
7831
8083
  }
7832
8084
  };
7833
8085
 
7834
- jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) {
8086
+ jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( _i, name ) {
7835
8087
  var getter = attrHandle[ name ] || jQuery.find.attr;
7836
8088
 
7837
8089
  attrHandle[ name ] = function( elem, name, isXML ) {
@@ -8455,7 +8707,9 @@ jQuery.extend( jQuery.event, {
8455
8707
  special.bindType || type;
8456
8708
 
8457
8709
  // jQuery handler
8458
- handle = ( dataPriv.get( cur, "events" ) || {} )[ event.type ] &&
8710
+ handle = (
8711
+ dataPriv.get( cur, "events" ) || Object.create( null )
8712
+ )[ event.type ] &&
8459
8713
  dataPriv.get( cur, "handle" );
8460
8714
  if ( handle ) {
8461
8715
  handle.apply( cur, data );
@@ -8566,7 +8820,10 @@ if ( !support.focusin ) {
8566
8820
 
8567
8821
  jQuery.event.special[ fix ] = {
8568
8822
  setup: function() {
8569
- var doc = this.ownerDocument || this,
8823
+
8824
+ // Handle: regular nodes (via `this.ownerDocument`), window
8825
+ // (via `this.document`) & document (via `this`).
8826
+ var doc = this.ownerDocument || this.document || this,
8570
8827
  attaches = dataPriv.access( doc, fix );
8571
8828
 
8572
8829
  if ( !attaches ) {
@@ -8575,7 +8832,7 @@ if ( !support.focusin ) {
8575
8832
  dataPriv.access( doc, fix, ( attaches || 0 ) + 1 );
8576
8833
  },
8577
8834
  teardown: function() {
8578
- var doc = this.ownerDocument || this,
8835
+ var doc = this.ownerDocument || this.document || this,
8579
8836
  attaches = dataPriv.access( doc, fix ) - 1;
8580
8837
 
8581
8838
  if ( !attaches ) {
@@ -8591,7 +8848,7 @@ if ( !support.focusin ) {
8591
8848
  }
8592
8849
  var location = window.location;
8593
8850
 
8594
- var nonce = Date.now();
8851
+ var nonce = { guid: Date.now() };
8595
8852
 
8596
8853
  var rquery = ( /\?/ );
8597
8854
 
@@ -8723,7 +8980,7 @@ jQuery.fn.extend( {
8723
8980
  rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) &&
8724
8981
  ( this.checked || !rcheckableType.test( type ) );
8725
8982
  } )
8726
- .map( function( i, elem ) {
8983
+ .map( function( _i, elem ) {
8727
8984
  var val = jQuery( this ).val();
8728
8985
 
8729
8986
  if ( val == null ) {
@@ -9336,7 +9593,8 @@ jQuery.extend( {
9336
9593
  // Add or update anti-cache param if needed
9337
9594
  if ( s.cache === false ) {
9338
9595
  cacheURL = cacheURL.replace( rantiCache, "$1" );
9339
- uncached = ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ( nonce++ ) + uncached;
9596
+ uncached = ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ( nonce.guid++ ) +
9597
+ uncached;
9340
9598
  }
9341
9599
 
9342
9600
  // Put hash and anti-cache on the URL that will be requested (gh-1732)
@@ -9469,6 +9727,11 @@ jQuery.extend( {
9469
9727
  response = ajaxHandleResponses( s, jqXHR, responses );
9470
9728
  }
9471
9729
 
9730
+ // Use a noop converter for missing script
9731
+ if ( !isSuccess && jQuery.inArray( "script", s.dataTypes ) > -1 ) {
9732
+ s.converters[ "text script" ] = function() {};
9733
+ }
9734
+
9472
9735
  // Convert no matter what (that way responseXXX fields are always set)
9473
9736
  response = ajaxConvert( s, response, jqXHR, isSuccess );
9474
9737
 
@@ -9559,7 +9822,7 @@ jQuery.extend( {
9559
9822
  }
9560
9823
  } );
9561
9824
 
9562
- jQuery.each( [ "get", "post" ], function( i, method ) {
9825
+ jQuery.each( [ "get", "post" ], function( _i, method ) {
9563
9826
  jQuery[ method ] = function( url, data, callback, type ) {
9564
9827
 
9565
9828
  // Shift arguments if data argument was omitted
@@ -9580,8 +9843,17 @@ jQuery.each( [ "get", "post" ], function( i, method ) {
9580
9843
  };
9581
9844
  } );
9582
9845
 
9846
+ jQuery.ajaxPrefilter( function( s ) {
9847
+ var i;
9848
+ for ( i in s.headers ) {
9849
+ if ( i.toLowerCase() === "content-type" ) {
9850
+ s.contentType = s.headers[ i ] || "";
9851
+ }
9852
+ }
9853
+ } );
9854
+
9583
9855
 
9584
- jQuery._evalUrl = function( url, options ) {
9856
+ jQuery._evalUrl = function( url, options, doc ) {
9585
9857
  return jQuery.ajax( {
9586
9858
  url: url,
9587
9859
 
@@ -9599,7 +9871,7 @@ jQuery._evalUrl = function( url, options ) {
9599
9871
  "text script": function() {}
9600
9872
  },
9601
9873
  dataFilter: function( response ) {
9602
- jQuery.globalEval( response, options );
9874
+ jQuery.globalEval( response, options, doc );
9603
9875
  }
9604
9876
  } );
9605
9877
  };
@@ -9921,7 +10193,7 @@ var oldCallbacks = [],
9921
10193
  jQuery.ajaxSetup( {
9922
10194
  jsonp: "callback",
9923
10195
  jsonpCallback: function() {
9924
- var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce++ ) );
10196
+ var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce.guid++ ) );
9925
10197
  this[ callback ] = true;
9926
10198
  return callback;
9927
10199
  }
@@ -10138,23 +10410,6 @@ jQuery.fn.load = function( url, params, callback ) {
10138
10410
 
10139
10411
 
10140
10412
 
10141
- // Attach a bunch of functions for handling common AJAX events
10142
- jQuery.each( [
10143
- "ajaxStart",
10144
- "ajaxStop",
10145
- "ajaxComplete",
10146
- "ajaxError",
10147
- "ajaxSuccess",
10148
- "ajaxSend"
10149
- ], function( i, type ) {
10150
- jQuery.fn[ type ] = function( fn ) {
10151
- return this.on( type, fn );
10152
- };
10153
- } );
10154
-
10155
-
10156
-
10157
-
10158
10413
  jQuery.expr.pseudos.animated = function( elem ) {
10159
10414
  return jQuery.grep( jQuery.timers, function( fn ) {
10160
10415
  return elem === fn.elem;
@@ -10211,6 +10466,12 @@ jQuery.offset = {
10211
10466
  options.using.call( elem, props );
10212
10467
 
10213
10468
  } else {
10469
+ if ( typeof props.top === "number" ) {
10470
+ props.top += "px";
10471
+ }
10472
+ if ( typeof props.left === "number" ) {
10473
+ props.left += "px";
10474
+ }
10214
10475
  curElem.css( props );
10215
10476
  }
10216
10477
  }
@@ -10361,7 +10622,7 @@ jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function(
10361
10622
  // Blink bug: https://bugs.chromium.org/p/chromium/issues/detail?id=589347
10362
10623
  // getComputedStyle returns percent when specified for top/left/bottom/right;
10363
10624
  // rather than make the css module depend on the offset module, just check for it here
10364
- jQuery.each( [ "top", "left" ], function( i, prop ) {
10625
+ jQuery.each( [ "top", "left" ], function( _i, prop ) {
10365
10626
  jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition,
10366
10627
  function( elem, computed ) {
10367
10628
  if ( computed ) {
@@ -10424,25 +10685,19 @@ jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
10424
10685
  } );
10425
10686
 
10426
10687
 
10427
- jQuery.each( ( "blur focus focusin focusout resize scroll click dblclick " +
10428
- "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
10429
- "change select submit keydown keypress keyup contextmenu" ).split( " " ),
10430
- function( i, name ) {
10431
-
10432
- // Handle event binding
10433
- jQuery.fn[ name ] = function( data, fn ) {
10434
- return arguments.length > 0 ?
10435
- this.on( name, null, data, fn ) :
10436
- this.trigger( name );
10688
+ jQuery.each( [
10689
+ "ajaxStart",
10690
+ "ajaxStop",
10691
+ "ajaxComplete",
10692
+ "ajaxError",
10693
+ "ajaxSuccess",
10694
+ "ajaxSend"
10695
+ ], function( _i, type ) {
10696
+ jQuery.fn[ type ] = function( fn ) {
10697
+ return this.on( type, fn );
10437
10698
  };
10438
10699
  } );
10439
10700
 
10440
- jQuery.fn.extend( {
10441
- hover: function( fnOver, fnOut ) {
10442
- return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
10443
- }
10444
- } );
10445
-
10446
10701
 
10447
10702
 
10448
10703
 
@@ -10464,9 +10719,33 @@ jQuery.fn.extend( {
10464
10719
  return arguments.length === 1 ?
10465
10720
  this.off( selector, "**" ) :
10466
10721
  this.off( types, selector || "**", fn );
10722
+ },
10723
+
10724
+ hover: function( fnOver, fnOut ) {
10725
+ return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
10467
10726
  }
10468
10727
  } );
10469
10728
 
10729
+ jQuery.each( ( "blur focus focusin focusout resize scroll click dblclick " +
10730
+ "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
10731
+ "change select submit keydown keypress keyup contextmenu" ).split( " " ),
10732
+ function( _i, name ) {
10733
+
10734
+ // Handle event binding
10735
+ jQuery.fn[ name ] = function( data, fn ) {
10736
+ return arguments.length > 0 ?
10737
+ this.on( name, null, data, fn ) :
10738
+ this.trigger( name );
10739
+ };
10740
+ } );
10741
+
10742
+
10743
+
10744
+
10745
+ // Support: Android <=4.0 only
10746
+ // Make sure we trim BOM and NBSP
10747
+ var rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;
10748
+
10470
10749
  // Bind a function to a context, optionally partially applying any
10471
10750
  // arguments.
10472
10751
  // jQuery.proxy is deprecated to promote standards (specifically Function#bind)
@@ -10529,6 +10808,11 @@ jQuery.isNumeric = function( obj ) {
10529
10808
  !isNaN( obj - parseFloat( obj ) );
10530
10809
  };
10531
10810
 
10811
+ jQuery.trim = function( text ) {
10812
+ return text == null ?
10813
+ "" :
10814
+ ( text + "" ).replace( rtrim, "" );
10815
+ };
10532
10816
 
10533
10817
 
10534
10818
 
@@ -10577,7 +10861,7 @@ jQuery.noConflict = function( deep ) {
10577
10861
  // Expose jQuery and $ identifiers, even in AMD
10578
10862
  // (#7102#comment:10, https://github.com/jquery/jquery/pull/557)
10579
10863
  // and CommonJS for browser emulators (#13566)
10580
- if ( !noGlobal ) {
10864
+ if ( typeof noGlobal === "undefined" ) {
10581
10865
  window.jQuery = window.$ = jQuery;
10582
10866
  }
10583
10867