jquery-rails 4.3.3 → 4.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 04d1efc7599676f1ea73a09cc228adedb46f6ed37b21d9116af50fe9bbe53421
4
- data.tar.gz: 48d97478901ba3d1f41625bedb98ba287ec04ab8165e1cf311ffa9d68056358d
3
+ metadata.gz: dcc6d11eb09cef26ed783513d708893c0d8fcede0b5027fc5906e59feeb880b9
4
+ data.tar.gz: 0e0c30ec8043042ccdc6099fb6f5f2b6055f8b52a42298fb35144280d15661da
5
5
  SHA512:
6
- metadata.gz: 8039284c3cfea4e800b89a6f97362b1a5614ba25ad7afce0175fb2330eb00d583bf3ad5b7ceb17d2447994953c7d472378459c4e1dc3775464f4b32723561247
7
- data.tar.gz: 802371ba0cef86bfa6273415a1be6216f16d37cdede192d172f8bb976bbe24073e8167271619d404bee08a5d9a583deab8de65ae52b71e974555e485153e2dd1
6
+ metadata.gz: a417086a5430147e22d452f1d192494d89890b7417257f759c721023f71a3f620a4f7328a5a5bd1c7e746786b861bc90aa1ba0174749b0a3f9dcef72a5e2ea78
7
+ data.tar.gz: badccf9a2417c5ac5623f667317ac33e2e27cf8aaf562be71a139f207006fd8469234e2cd48fdcd9860e658710dff4bd53272066e688033fceddeced9267af6d
data/.travis.yml CHANGED
@@ -7,8 +7,10 @@ rvm:
7
7
  - 2.1.10
8
8
  - 2.2.9
9
9
  - 2.3.6
10
- - 2.4.3
11
- - 2.5.0
10
+ - 2.4.10
11
+ - 2.5.8
12
+ - 2.6.6
13
+ - 2.7.1
12
14
  - jruby
13
15
  - ruby-head
14
16
  matrix:
data/CHANGELOG.md CHANGED
@@ -1,3 +1,17 @@
1
+ ## 4.4.0
2
+
3
+ - update jquery to 3.5.1 (note: [3.5.0 contains important security updates](https://github.com/advisories/GHSA-jpcq-cgw6-v4j6))
4
+ - unescape dollar signs and backticks in `assert_select_jquery` to match
5
+ Rails updated behavior.
6
+
7
+ ## 4.3.5
8
+
9
+ - update jquery to 3.4.1
10
+
11
+ ## 4.3.4
12
+
13
+ - update jquery to 3.4.0
14
+
1
15
  ## 4.3.3
2
16
 
3
17
  - update jquery to 3.3.1
data/README.md CHANGED
@@ -24,6 +24,12 @@ versions of jQuery.
24
24
 
25
25
  ## Installation
26
26
 
27
+ Add
28
+ ```
29
+ gem 'jquery-rails'
30
+ ```
31
+ to your Gemfile.
32
+
27
33
  The jquery and jquery-ujs files will be added to the asset pipeline and available for you to use. If they're not already in `app/assets/javascripts/application.js` by default, add these lines:
28
34
 
29
35
  ```js
@@ -72,4 +78,4 @@ jquery-rails is released under the [MIT License](MIT-LICENSE).
72
78
 
73
79
  ## Acknowledgements
74
80
 
75
- Many thanks are due to all of [the jquery-rails contributors](https://github.com/rails/jquery-rails/graphs/contributors). Special thanks to [JangoSteve](http://github.com/JangoSteve) for tirelessly answering questions and accepting patches, and the [Rails Core Team](https://github.com/organizations/rails/teams/617) for making jquery-rails an official part of Rails 3.1.
81
+ Many thanks are due to all of [the jquery-rails contributors](https://github.com/rails/jquery-rails/graphs/contributors). Special thanks to [JangoSteve](http://github.com/JangoSteve) for tirelessly answering questions and accepting patches, and the [Rails Core Team](https://github.com/orgs/rails/people) for making jquery-rails an official part of Rails 3.1.
data/VERSIONS.md CHANGED
@@ -2,6 +2,9 @@
2
2
 
3
3
  | Gem | jQuery | jQuery UJS | jQuery UI |
4
4
  |--------|--------|------------| ----------|
5
+ | 4.4.0 | 1.12.4 & 2.2.4 & 3.5.1 | 1.2.2 | - |
6
+ | 4.3.5 | 1.12.4 & 2.2.4 & 3.4.1 | 1.2.2 | - |
7
+ | 4.3.4 | 1.12.4 & 2.2.4 & 3.4.0 | 1.2.2 | - |
5
8
  | 4.3.3 | 1.12.4 & 2.2.4 & 3.3.1 | 1.2.2 | - |
6
9
  | 4.3.2 | 1.12.4 & 2.2.4 & 3.3.0 | 1.2.2 | - |
7
10
  | 4.3.1 | 1.12.4 & 2.2.4 & 3.2.1 | 1.2.2 | - |
@@ -49,7 +49,7 @@ module Rails::Dom::Testing::Assertions::SelectorAssertions
49
49
 
50
50
  PATTERN_HTML = "['\"]((\\\\\"|\\\\'|[^\"'])*)['\"]"
51
51
  PATTERN_UNICODE_ESCAPED_CHAR = /\\u([0-9a-zA-Z]{4})/
52
- SKELETAL_PATTERN = "(?:jQuery|\\$)\\(%s\\)\\.%s\\(%s\\);"
52
+ SKELETAL_PATTERN = "(?:jQuery|\\$)\\(%s\\)\\.%s\\(%s\\)[;]?"
53
53
 
54
54
  def assert_select_jquery(*args, &block)
55
55
  jquery_method = args.first.is_a?(Symbol) ? args.shift : nil
@@ -124,6 +124,8 @@ module Rails::Dom::Testing::Assertions::SelectorAssertions
124
124
  unescaped.gsub!('\n', "\n")
125
125
  unescaped.gsub!('\076', '>')
126
126
  unescaped.gsub!('\074', '<')
127
+ unescaped.gsub!(/\\\$/, '$')
128
+ unescaped.gsub!(/\\`/, '`')
127
129
  # js encodes non-ascii characters.
128
130
  unescaped.gsub!(PATTERN_UNICODE_ESCAPED_CHAR) {|u| [$1.hex].pack('U*')}
129
131
  unescaped
@@ -1,9 +1,9 @@
1
1
  module Jquery
2
2
  module Rails
3
- VERSION = "4.3.3"
3
+ VERSION = "4.4.0"
4
4
  JQUERY_VERSION = "1.12.4"
5
5
  JQUERY_2_VERSION = "2.2.4"
6
- JQUERY_3_VERSION = "3.3.1"
6
+ JQUERY_3_VERSION = "3.5.1"
7
7
  JQUERY_UJS_VERSION = "1.2.2"
8
8
  end
9
9
  end
@@ -1,3 +1,4 @@
1
+ require 'ostruct'
1
2
  require_relative 'test_helper'
2
3
  require_relative '../lib/jquery/assert_select'
3
4
 
@@ -19,6 +20,11 @@ class AssertSelectJQueryTest < ActiveSupport::TestCase
19
20
  $("#cart tr:not(.total_line) > *").remove();
20
21
  $("[href|=\"val\"][href$=\"val\"][href^=\"val\"]").remove();
21
22
  $("tr + td, li").remove();
23
+
24
+ // without semicolon
25
+ $("#browser_cart").hide("blind", 1000)
26
+
27
+ $('#item').html('<div><span>\\`Total\\`: \\$12.34</span></div>');
22
28
  JS
23
29
 
24
30
  setup do
@@ -28,6 +34,7 @@ class AssertSelectJQueryTest < ActiveSupport::TestCase
28
34
  def test_target_as_receiver
29
35
  assert_nothing_raised do
30
36
  assert_select_jquery :show, :blind, '#card'
37
+ assert_select_jquery :hide, :blind, '#browser_cart'
31
38
  assert_select_jquery :html, '#id' do
32
39
  assert_select 'p', 'something'
33
40
  end
@@ -38,6 +45,10 @@ class AssertSelectJQueryTest < ActiveSupport::TestCase
38
45
  assert_select_jquery :remove, "#cart tr:not(.total_line) > *"
39
46
  assert_select_jquery :remove, "[href|=\"val\"][href$=\"val\"][href^=\"val\"]"
40
47
  assert_select_jquery :remove, "tr + td, li"
48
+
49
+ assert_select_jquery :html, '#item' do
50
+ assert_select 'span', '`Total`: $12.34'
51
+ end
41
52
  end
42
53
 
43
54
  assert_raise Minitest::Assertion, "No JQuery call matches [:show, :some_wrong]" do
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * jQuery JavaScript Library v3.3.1
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: 2018-01-20T17:24Z
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,25 +89,40 @@ 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 = {
92
97
  type: true,
93
98
  src: true,
99
+ nonce: true,
94
100
  noModule: true
95
101
  };
96
102
 
97
- function DOMEval( code, doc, node ) {
103
+ function DOMEval( code, node, doc ) {
98
104
  doc = doc || document;
99
105
 
100
- var i,
106
+ var i, val,
101
107
  script = doc.createElement( "script" );
102
108
 
103
109
  script.text = code;
104
110
  if ( node ) {
105
111
  for ( i in preservedScriptAttributes ) {
106
- if ( node[ i ] ) {
107
- script[ i ] = node[ i ];
112
+
113
+ // Support: Firefox 64+, Edge 18+
114
+ // Some browsers don't support the "nonce" property on scripts.
115
+ // On the other hand, just using `getAttribute` is not enough as
116
+ // the `nonce` attribute is reset to an empty string whenever it
117
+ // becomes browsing-context connected.
118
+ // See https://github.com/whatwg/html/issues/2369
119
+ // See https://html.spec.whatwg.org/#nonce-attributes
120
+ // The `node.getAttribute` check was added for the sake of
121
+ // `jQuery.globalEval` so that it can fake a nonce-containing node
122
+ // via an object.
123
+ val = node[ i ] || node.getAttribute && node.getAttribute( i );
124
+ if ( val ) {
125
+ script.setAttribute( i, val );
108
126
  }
109
127
  }
110
128
  }
@@ -129,7 +147,7 @@ function toType( obj ) {
129
147
 
130
148
 
131
149
  var
132
- version = "3.3.1",
150
+ version = "3.5.1",
133
151
 
134
152
  // Define a local copy of jQuery
135
153
  jQuery = function( selector, context ) {
@@ -137,11 +155,7 @@ var
137
155
  // The jQuery object is actually just the init constructor 'enhanced'
138
156
  // Need init if jQuery is called (just allow error to be thrown if not included)
139
157
  return new jQuery.fn.init( selector, context );
140
- },
141
-
142
- // Support: Android <=4.0 only
143
- // Make sure we trim BOM and NBSP
144
- rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;
158
+ };
145
159
 
146
160
  jQuery.fn = jQuery.prototype = {
147
161
 
@@ -207,6 +221,18 @@ jQuery.fn = jQuery.prototype = {
207
221
  return this.eq( -1 );
208
222
  },
209
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
+
210
236
  eq: function( i ) {
211
237
  var len = this.length,
212
238
  j = +i + ( i < 0 ? len : 0 );
@@ -258,25 +284,28 @@ jQuery.extend = jQuery.fn.extend = function() {
258
284
 
259
285
  // Extend the base object
260
286
  for ( name in options ) {
261
- src = target[ name ];
262
287
  copy = options[ name ];
263
288
 
289
+ // Prevent Object.prototype pollution
264
290
  // Prevent never-ending loop
265
- if ( target === copy ) {
291
+ if ( name === "__proto__" || target === copy ) {
266
292
  continue;
267
293
  }
268
294
 
269
295
  // Recurse if we're merging plain objects or arrays
270
296
  if ( deep && copy && ( jQuery.isPlainObject( copy ) ||
271
297
  ( copyIsArray = Array.isArray( copy ) ) ) ) {
298
+ src = target[ name ];
272
299
 
273
- if ( copyIsArray ) {
274
- copyIsArray = false;
275
- clone = src && Array.isArray( src ) ? src : [];
276
-
300
+ // Ensure proper type for the source value
301
+ if ( copyIsArray && !Array.isArray( src ) ) {
302
+ clone = [];
303
+ } else if ( !copyIsArray && !jQuery.isPlainObject( src ) ) {
304
+ clone = {};
277
305
  } else {
278
- clone = src && jQuery.isPlainObject( src ) ? src : {};
306
+ clone = src;
279
307
  }
308
+ copyIsArray = false;
280
309
 
281
310
  // Never move original objects, clone them
282
311
  target[ name ] = jQuery.extend( deep, clone, copy );
@@ -329,9 +358,6 @@ jQuery.extend( {
329
358
  },
330
359
 
331
360
  isEmptyObject: function( obj ) {
332
-
333
- /* eslint-disable no-unused-vars */
334
- // See https://github.com/eslint/eslint/issues/6125
335
361
  var name;
336
362
 
337
363
  for ( name in obj ) {
@@ -340,9 +366,10 @@ jQuery.extend( {
340
366
  return true;
341
367
  },
342
368
 
343
- // Evaluates a script in a global context
344
- globalEval: function( code ) {
345
- DOMEval( code );
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 );
346
373
  },
347
374
 
348
375
  each: function( obj, callback ) {
@@ -366,13 +393,6 @@ jQuery.extend( {
366
393
  return obj;
367
394
  },
368
395
 
369
- // Support: Android <=4.0 only
370
- trim: function( text ) {
371
- return text == null ?
372
- "" :
373
- ( text + "" ).replace( rtrim, "" );
374
- },
375
-
376
396
  // results is for internal usage only
377
397
  makeArray: function( arr, results ) {
378
398
  var ret = results || [];
@@ -459,7 +479,7 @@ jQuery.extend( {
459
479
  }
460
480
 
461
481
  // Flatten any nested arrays
462
- return concat.apply( [], ret );
482
+ return flat( ret );
463
483
  },
464
484
 
465
485
  // A global GUID counter for objects
@@ -476,7 +496,7 @@ if ( typeof Symbol === "function" ) {
476
496
 
477
497
  // Populate the class2type map
478
498
  jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ),
479
- function( i, name ) {
499
+ function( _i, name ) {
480
500
  class2type[ "[object " + name + "]" ] = name.toLowerCase();
481
501
  } );
482
502
 
@@ -498,17 +518,16 @@ function isArrayLike( obj ) {
498
518
  }
499
519
  var Sizzle =
500
520
  /*!
501
- * Sizzle CSS Selector Engine v2.3.3
521
+ * Sizzle CSS Selector Engine v2.3.5
502
522
  * https://sizzlejs.com/
503
523
  *
504
- * Copyright jQuery Foundation and other contributors
524
+ * Copyright JS Foundation and other contributors
505
525
  * Released under the MIT license
506
- * http://jquery.org/license
526
+ * https://js.foundation/
507
527
  *
508
- * Date: 2016-08-08
528
+ * Date: 2020-03-14
509
529
  */
510
- (function( window ) {
511
-
530
+ ( function( window ) {
512
531
  var i,
513
532
  support,
514
533
  Expr,
@@ -539,6 +558,7 @@ var i,
539
558
  classCache = createCache(),
540
559
  tokenCache = createCache(),
541
560
  compilerCache = createCache(),
561
+ nonnativeSelectorCache = createCache(),
542
562
  sortOrder = function( a, b ) {
543
563
  if ( a === b ) {
544
564
  hasDuplicate = true;
@@ -547,61 +567,71 @@ var i,
547
567
  },
548
568
 
549
569
  // Instance methods
550
- hasOwn = ({}).hasOwnProperty,
570
+ hasOwn = ( {} ).hasOwnProperty,
551
571
  arr = [],
552
572
  pop = arr.pop,
553
- push_native = arr.push,
573
+ pushNative = arr.push,
554
574
  push = arr.push,
555
575
  slice = arr.slice,
576
+
556
577
  // Use a stripped-down indexOf as it's faster than native
557
578
  // https://jsperf.com/thor-indexof-vs-for/5
558
579
  indexOf = function( list, elem ) {
559
580
  var i = 0,
560
581
  len = list.length;
561
582
  for ( ; i < len; i++ ) {
562
- if ( list[i] === elem ) {
583
+ if ( list[ i ] === elem ) {
563
584
  return i;
564
585
  }
565
586
  }
566
587
  return -1;
567
588
  },
568
589
 
569
- 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",
570
592
 
571
593
  // Regular expressions
572
594
 
573
595
  // http://www.w3.org/TR/css3-selectors/#whitespace
574
596
  whitespace = "[\\x20\\t\\r\\n\\f]",
575
597
 
576
- // http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
577
- 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])+",
578
601
 
579
602
  // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors
580
603
  attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace +
604
+
581
605
  // Operator (capture 2)
582
606
  "*([*^$|!~]?=)" + whitespace +
583
- // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]"
584
- "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace +
585
- "*\\]",
607
+
608
+ // "Attribute values must be CSS identifiers [capture 5]
609
+ // or strings [capture 3 or capture 4]"
610
+ "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" +
611
+ whitespace + "*\\]",
586
612
 
587
613
  pseudos = ":(" + identifier + ")(?:\\((" +
614
+
588
615
  // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments:
589
616
  // 1. quoted (capture 3; capture 4 or capture 5)
590
617
  "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" +
618
+
591
619
  // 2. simple (capture 6)
592
620
  "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" +
621
+
593
622
  // 3. anything else (capture 2)
594
623
  ".*" +
595
624
  ")\\)|)",
596
625
 
597
626
  // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
598
627
  rwhitespace = new RegExp( whitespace + "+", "g" ),
599
- rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ),
628
+ rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" +
629
+ whitespace + "+$", "g" ),
600
630
 
601
631
  rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
602
- rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ),
603
-
604
- rattributeQuotes = new RegExp( "=" + whitespace + "*([^\\]'\"]*?)" + whitespace + "*\\]", "g" ),
632
+ rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace +
633
+ "*" ),
634
+ rdescend = new RegExp( whitespace + "|>" ),
605
635
 
606
636
  rpseudo = new RegExp( pseudos ),
607
637
  ridentifier = new RegExp( "^" + identifier + "$" ),
@@ -612,16 +642,19 @@ var i,
612
642
  "TAG": new RegExp( "^(" + identifier + "|[*])" ),
613
643
  "ATTR": new RegExp( "^" + attributes ),
614
644
  "PSEUDO": new RegExp( "^" + pseudos ),
615
- "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace +
616
- "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace +
617
- "*(\\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" ),
618
648
  "bool": new RegExp( "^(?:" + booleans + ")$", "i" ),
649
+
619
650
  // For use in libraries implementing .is()
620
651
  // We use this for POS matching in `select`
621
- "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" +
622
- 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" )
623
655
  },
624
656
 
657
+ rhtml = /HTML$/i,
625
658
  rinputs = /^(?:input|select|textarea|button)$/i,
626
659
  rheader = /^h\d$/i,
627
660
 
@@ -634,18 +667,21 @@ var i,
634
667
 
635
668
  // CSS escapes
636
669
  // http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
637
- runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ),
638
- funescape = function( _, escaped, escapedWhitespace ) {
639
- var high = "0x" + escaped - 0x10000;
640
- // NaN means non-codepoint
641
- // Support: Firefox<24
642
- // Workaround erroneous numeric interpretation of +"0x"
643
- return high !== high || escapedWhitespace ?
644
- 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
645
683
  high < 0 ?
646
- // BMP codepoint
647
684
  String.fromCharCode( high + 0x10000 ) :
648
- // Supplemental Plane codepoint (surrogate pair)
649
685
  String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
650
686
  },
651
687
 
@@ -661,7 +697,8 @@ var i,
661
697
  }
662
698
 
663
699
  // Control characters and (dependent upon position) numbers get escaped as code points
664
- 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 ) + " ";
665
702
  }
666
703
 
667
704
  // Other potentially-special ASCII characters get backslash-escaped
@@ -676,9 +713,9 @@ var i,
676
713
  setDocument();
677
714
  },
678
715
 
679
- disabledAncestor = addCombinator(
716
+ inDisabledFieldset = addCombinator(
680
717
  function( elem ) {
681
- return elem.disabled === true && ("form" in elem || "label" in elem);
718
+ return elem.disabled === true && elem.nodeName.toLowerCase() === "fieldset";
682
719
  },
683
720
  { dir: "parentNode", next: "legend" }
684
721
  );
@@ -686,18 +723,20 @@ var i,
686
723
  // Optimize for push.apply( _, NodeList )
687
724
  try {
688
725
  push.apply(
689
- (arr = slice.call( preferredDoc.childNodes )),
726
+ ( arr = slice.call( preferredDoc.childNodes ) ),
690
727
  preferredDoc.childNodes
691
728
  );
729
+
692
730
  // Support: Android<4.0
693
731
  // Detect silently failing push.apply
732
+ // eslint-disable-next-line no-unused-expressions
694
733
  arr[ preferredDoc.childNodes.length ].nodeType;
695
734
  } catch ( e ) {
696
735
  push = { apply: arr.length ?
697
736
 
698
737
  // Leverage slice if possible
699
738
  function( target, els ) {
700
- push_native.apply( target, slice.call(els) );
739
+ pushNative.apply( target, slice.call( els ) );
701
740
  } :
702
741
 
703
742
  // Support: IE<9
@@ -705,8 +744,9 @@ try {
705
744
  function( target, els ) {
706
745
  var j = target.length,
707
746
  i = 0;
747
+
708
748
  // Can't trust NodeList.length
709
- while ( (target[j++] = els[i++]) ) {}
749
+ while ( ( target[ j++ ] = els[ i++ ] ) ) {}
710
750
  target.length = j - 1;
711
751
  }
712
752
  };
@@ -730,24 +770,21 @@ function Sizzle( selector, context, results, seed ) {
730
770
 
731
771
  // Try to shortcut find operations (as opposed to filters) in HTML documents
732
772
  if ( !seed ) {
733
-
734
- if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) {
735
- setDocument( context );
736
- }
773
+ setDocument( context );
737
774
  context = context || document;
738
775
 
739
776
  if ( documentIsHTML ) {
740
777
 
741
778
  // If the selector is sufficiently simple, try using a "get*By*" DOM method
742
779
  // (excepting DocumentFragment context, where the methods don't exist)
743
- if ( nodeType !== 11 && (match = rquickExpr.exec( selector )) ) {
780
+ if ( nodeType !== 11 && ( match = rquickExpr.exec( selector ) ) ) {
744
781
 
745
782
  // ID selector
746
- if ( (m = match[1]) ) {
783
+ if ( ( m = match[ 1 ] ) ) {
747
784
 
748
785
  // Document context
749
786
  if ( nodeType === 9 ) {
750
- if ( (elem = context.getElementById( m )) ) {
787
+ if ( ( elem = context.getElementById( m ) ) ) {
751
788
 
752
789
  // Support: IE, Opera, Webkit
753
790
  // TODO: identify versions
@@ -766,7 +803,7 @@ function Sizzle( selector, context, results, seed ) {
766
803
  // Support: IE, Opera, Webkit
767
804
  // TODO: identify versions
768
805
  // getElementById can match elements by name instead of ID
769
- if ( newContext && (elem = newContext.getElementById( m )) &&
806
+ if ( newContext && ( elem = newContext.getElementById( m ) ) &&
770
807
  contains( context, elem ) &&
771
808
  elem.id === m ) {
772
809
 
@@ -776,12 +813,12 @@ function Sizzle( selector, context, results, seed ) {
776
813
  }
777
814
 
778
815
  // Type selector
779
- } else if ( match[2] ) {
816
+ } else if ( match[ 2 ] ) {
780
817
  push.apply( results, context.getElementsByTagName( selector ) );
781
818
  return results;
782
819
 
783
820
  // Class selector
784
- } else if ( (m = match[3]) && support.getElementsByClassName &&
821
+ } else if ( ( m = match[ 3 ] ) && support.getElementsByClassName &&
785
822
  context.getElementsByClassName ) {
786
823
 
787
824
  push.apply( results, context.getElementsByClassName( m ) );
@@ -791,50 +828,62 @@ function Sizzle( selector, context, results, seed ) {
791
828
 
792
829
  // Take advantage of querySelectorAll
793
830
  if ( support.qsa &&
794
- !compilerCache[ selector + " " ] &&
795
- (!rbuggyQSA || !rbuggyQSA.test( selector )) ) {
796
-
797
- if ( nodeType !== 1 ) {
798
- newContext = context;
799
- newSelector = selector;
831
+ !nonnativeSelectorCache[ selector + " " ] &&
832
+ ( !rbuggyQSA || !rbuggyQSA.test( selector ) ) &&
800
833
 
801
- // qSA looks outside Element context, which is not what we want
802
- // Thanks to Andrew Dupont for this workaround technique
803
- // Support: IE <=8
834
+ // Support: IE 8 only
804
835
  // Exclude object elements
805
- } else if ( context.nodeName.toLowerCase() !== "object" ) {
836
+ ( nodeType !== 1 || context.nodeName.toLowerCase() !== "object" ) ) {
806
837
 
807
- // Capture the context ID, setting it first if necessary
808
- if ( (nid = context.getAttribute( "id" )) ) {
809
- nid = nid.replace( rcssescape, fcssescape );
810
- } else {
811
- context.setAttribute( "id", (nid = expando) );
838
+ newSelector = selector;
839
+ newContext = context;
840
+
841
+ // qSA considers elements outside a scoping root when evaluating child or
842
+ // descendant combinators, which is not what we want.
843
+ // In such cases, we work around the behavior by prefixing every selector in the
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.
847
+ // Thanks to Andrew Dupont for this technique.
848
+ if ( nodeType === 1 &&
849
+ ( rdescend.test( selector ) || rcombinators.test( selector ) ) ) {
850
+
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
+ }
812
865
  }
813
866
 
814
867
  // Prefix every selector in the list
815
868
  groups = tokenize( selector );
816
869
  i = groups.length;
817
870
  while ( i-- ) {
818
- groups[i] = "#" + nid + " " + toSelector( groups[i] );
871
+ groups[ i ] = ( nid ? "#" + nid : ":scope" ) + " " +
872
+ toSelector( groups[ i ] );
819
873
  }
820
874
  newSelector = groups.join( "," );
821
-
822
- // Expand context for sibling selectors
823
- newContext = rsibling.test( selector ) && testContext( context.parentNode ) ||
824
- context;
825
875
  }
826
876
 
827
- if ( newSelector ) {
828
- try {
829
- push.apply( results,
830
- newContext.querySelectorAll( newSelector )
831
- );
832
- return results;
833
- } catch ( qsaError ) {
834
- } finally {
835
- if ( nid === expando ) {
836
- context.removeAttribute( "id" );
837
- }
877
+ try {
878
+ push.apply( results,
879
+ newContext.querySelectorAll( newSelector )
880
+ );
881
+ return results;
882
+ } catch ( qsaError ) {
883
+ nonnativeSelectorCache( selector, true );
884
+ } finally {
885
+ if ( nid === expando ) {
886
+ context.removeAttribute( "id" );
838
887
  }
839
888
  }
840
889
  }
@@ -855,12 +904,14 @@ function createCache() {
855
904
  var keys = [];
856
905
 
857
906
  function cache( key, value ) {
907
+
858
908
  // Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
859
909
  if ( keys.push( key + " " ) > Expr.cacheLength ) {
910
+
860
911
  // Only keep the most recent entries
861
912
  delete cache[ keys.shift() ];
862
913
  }
863
- return (cache[ key + " " ] = value);
914
+ return ( cache[ key + " " ] = value );
864
915
  }
865
916
  return cache;
866
917
  }
@@ -879,17 +930,19 @@ function markFunction( fn ) {
879
930
  * @param {Function} fn Passed the created element and returns a boolean result
880
931
  */
881
932
  function assert( fn ) {
882
- var el = document.createElement("fieldset");
933
+ var el = document.createElement( "fieldset" );
883
934
 
884
935
  try {
885
936
  return !!fn( el );
886
- } catch (e) {
937
+ } catch ( e ) {
887
938
  return false;
888
939
  } finally {
940
+
889
941
  // Remove from its parent by default
890
942
  if ( el.parentNode ) {
891
943
  el.parentNode.removeChild( el );
892
944
  }
945
+
893
946
  // release memory in IE
894
947
  el = null;
895
948
  }
@@ -901,11 +954,11 @@ function assert( fn ) {
901
954
  * @param {Function} handler The method that will be applied
902
955
  */
903
956
  function addHandle( attrs, handler ) {
904
- var arr = attrs.split("|"),
957
+ var arr = attrs.split( "|" ),
905
958
  i = arr.length;
906
959
 
907
960
  while ( i-- ) {
908
- Expr.attrHandle[ arr[i] ] = handler;
961
+ Expr.attrHandle[ arr[ i ] ] = handler;
909
962
  }
910
963
  }
911
964
 
@@ -927,7 +980,7 @@ function siblingCheck( a, b ) {
927
980
 
928
981
  // Check if b follows a
929
982
  if ( cur ) {
930
- while ( (cur = cur.nextSibling) ) {
983
+ while ( ( cur = cur.nextSibling ) ) {
931
984
  if ( cur === b ) {
932
985
  return -1;
933
986
  }
@@ -955,7 +1008,7 @@ function createInputPseudo( type ) {
955
1008
  function createButtonPseudo( type ) {
956
1009
  return function( elem ) {
957
1010
  var name = elem.nodeName.toLowerCase();
958
- return (name === "input" || name === "button") && elem.type === type;
1011
+ return ( name === "input" || name === "button" ) && elem.type === type;
959
1012
  };
960
1013
  }
961
1014
 
@@ -998,7 +1051,7 @@ function createDisabledPseudo( disabled ) {
998
1051
  // Where there is no isDisabled, check manually
999
1052
  /* jshint -W018 */
1000
1053
  elem.isDisabled !== !disabled &&
1001
- disabledAncestor( elem ) === disabled;
1054
+ inDisabledFieldset( elem ) === disabled;
1002
1055
  }
1003
1056
 
1004
1057
  return elem.disabled === disabled;
@@ -1020,21 +1073,21 @@ function createDisabledPseudo( disabled ) {
1020
1073
  * @param {Function} fn
1021
1074
  */
1022
1075
  function createPositionalPseudo( fn ) {
1023
- return markFunction(function( argument ) {
1076
+ return markFunction( function( argument ) {
1024
1077
  argument = +argument;
1025
- return markFunction(function( seed, matches ) {
1078
+ return markFunction( function( seed, matches ) {
1026
1079
  var j,
1027
1080
  matchIndexes = fn( [], seed.length, argument ),
1028
1081
  i = matchIndexes.length;
1029
1082
 
1030
1083
  // Match elements found at the specified indexes
1031
1084
  while ( i-- ) {
1032
- if ( seed[ (j = matchIndexes[i]) ] ) {
1033
- seed[j] = !(matches[j] = seed[j]);
1085
+ if ( seed[ ( j = matchIndexes[ i ] ) ] ) {
1086
+ seed[ j ] = !( matches[ j ] = seed[ j ] );
1034
1087
  }
1035
1088
  }
1036
- });
1037
- });
1089
+ } );
1090
+ } );
1038
1091
  }
1039
1092
 
1040
1093
  /**
@@ -1055,10 +1108,13 @@ support = Sizzle.support = {};
1055
1108
  * @returns {Boolean} True iff elem is a non-HTML XML node
1056
1109
  */
1057
1110
  isXML = Sizzle.isXML = function( elem ) {
1058
- // documentElement is verified for cases where it doesn't yet exist
1059
- // (such as loading iframes in IE - #4833)
1060
- var documentElement = elem && (elem.ownerDocument || elem).documentElement;
1061
- return documentElement ? documentElement.nodeName !== "HTML" : false;
1111
+ var namespace = elem.namespaceURI,
1112
+ docElem = ( elem.ownerDocument || elem ).documentElement;
1113
+
1114
+ // Support: IE <=8
1115
+ // Assume HTML when documentElement doesn't yet exist, such as inside loading iframes
1116
+ // https://bugs.jquery.com/ticket/4833
1117
+ return !rhtml.test( namespace || docElem && docElem.nodeName || "HTML" );
1062
1118
  };
1063
1119
 
1064
1120
  /**
@@ -1071,7 +1127,11 @@ setDocument = Sizzle.setDocument = function( node ) {
1071
1127
  doc = node ? node.ownerDocument || node : preferredDoc;
1072
1128
 
1073
1129
  // Return early if doc is invalid or already selected
1074
- 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 ) {
1075
1135
  return document;
1076
1136
  }
1077
1137
 
@@ -1080,10 +1140,14 @@ setDocument = Sizzle.setDocument = function( node ) {
1080
1140
  docElem = document.documentElement;
1081
1141
  documentIsHTML = !isXML( document );
1082
1142
 
1083
- // Support: IE 9-11, Edge
1143
+ // Support: IE 9 - 11+, Edge 12 - 18+
1084
1144
  // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936)
1085
- if ( preferredDoc !== document &&
1086
- (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 ) {
1087
1151
 
1088
1152
  // Support: IE 11, Edge
1089
1153
  if ( subWindow.addEventListener ) {
@@ -1095,25 +1159,36 @@ setDocument = Sizzle.setDocument = function( node ) {
1095
1159
  }
1096
1160
  }
1097
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
+
1098
1173
  /* Attributes
1099
1174
  ---------------------------------------------------------------------- */
1100
1175
 
1101
1176
  // Support: IE<8
1102
1177
  // Verify that getAttribute really returns attributes and not properties
1103
1178
  // (excepting IE8 booleans)
1104
- support.attributes = assert(function( el ) {
1179
+ support.attributes = assert( function( el ) {
1105
1180
  el.className = "i";
1106
- return !el.getAttribute("className");
1107
- });
1181
+ return !el.getAttribute( "className" );
1182
+ } );
1108
1183
 
1109
1184
  /* getElement(s)By*
1110
1185
  ---------------------------------------------------------------------- */
1111
1186
 
1112
1187
  // Check if getElementsByTagName("*") returns only elements
1113
- support.getElementsByTagName = assert(function( el ) {
1114
- el.appendChild( document.createComment("") );
1115
- return !el.getElementsByTagName("*").length;
1116
- });
1188
+ support.getElementsByTagName = assert( function( el ) {
1189
+ el.appendChild( document.createComment( "" ) );
1190
+ return !el.getElementsByTagName( "*" ).length;
1191
+ } );
1117
1192
 
1118
1193
  // Support: IE<9
1119
1194
  support.getElementsByClassName = rnative.test( document.getElementsByClassName );
@@ -1122,38 +1197,38 @@ setDocument = Sizzle.setDocument = function( node ) {
1122
1197
  // Check if getElementById returns elements by name
1123
1198
  // The broken getElementById methods don't pick up programmatically-set names,
1124
1199
  // so use a roundabout getElementsByName test
1125
- support.getById = assert(function( el ) {
1200
+ support.getById = assert( function( el ) {
1126
1201
  docElem.appendChild( el ).id = expando;
1127
1202
  return !document.getElementsByName || !document.getElementsByName( expando ).length;
1128
- });
1203
+ } );
1129
1204
 
1130
1205
  // ID filter and find
1131
1206
  if ( support.getById ) {
1132
- Expr.filter["ID"] = function( id ) {
1207
+ Expr.filter[ "ID" ] = function( id ) {
1133
1208
  var attrId = id.replace( runescape, funescape );
1134
1209
  return function( elem ) {
1135
- return elem.getAttribute("id") === attrId;
1210
+ return elem.getAttribute( "id" ) === attrId;
1136
1211
  };
1137
1212
  };
1138
- Expr.find["ID"] = function( id, context ) {
1213
+ Expr.find[ "ID" ] = function( id, context ) {
1139
1214
  if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
1140
1215
  var elem = context.getElementById( id );
1141
1216
  return elem ? [ elem ] : [];
1142
1217
  }
1143
1218
  };
1144
1219
  } else {
1145
- Expr.filter["ID"] = function( id ) {
1220
+ Expr.filter[ "ID" ] = function( id ) {
1146
1221
  var attrId = id.replace( runescape, funescape );
1147
1222
  return function( elem ) {
1148
1223
  var node = typeof elem.getAttributeNode !== "undefined" &&
1149
- elem.getAttributeNode("id");
1224
+ elem.getAttributeNode( "id" );
1150
1225
  return node && node.value === attrId;
1151
1226
  };
1152
1227
  };
1153
1228
 
1154
1229
  // Support: IE 6 - 7 only
1155
1230
  // getElementById is not reliable as a find shortcut
1156
- Expr.find["ID"] = function( id, context ) {
1231
+ Expr.find[ "ID" ] = function( id, context ) {
1157
1232
  if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
1158
1233
  var node, i, elems,
1159
1234
  elem = context.getElementById( id );
@@ -1161,7 +1236,7 @@ setDocument = Sizzle.setDocument = function( node ) {
1161
1236
  if ( elem ) {
1162
1237
 
1163
1238
  // Verify the id attribute
1164
- node = elem.getAttributeNode("id");
1239
+ node = elem.getAttributeNode( "id" );
1165
1240
  if ( node && node.value === id ) {
1166
1241
  return [ elem ];
1167
1242
  }
@@ -1169,8 +1244,8 @@ setDocument = Sizzle.setDocument = function( node ) {
1169
1244
  // Fall back on getElementsByName
1170
1245
  elems = context.getElementsByName( id );
1171
1246
  i = 0;
1172
- while ( (elem = elems[i++]) ) {
1173
- node = elem.getAttributeNode("id");
1247
+ while ( ( elem = elems[ i++ ] ) ) {
1248
+ node = elem.getAttributeNode( "id" );
1174
1249
  if ( node && node.value === id ) {
1175
1250
  return [ elem ];
1176
1251
  }
@@ -1183,7 +1258,7 @@ setDocument = Sizzle.setDocument = function( node ) {
1183
1258
  }
1184
1259
 
1185
1260
  // Tag
1186
- Expr.find["TAG"] = support.getElementsByTagName ?
1261
+ Expr.find[ "TAG" ] = support.getElementsByTagName ?
1187
1262
  function( tag, context ) {
1188
1263
  if ( typeof context.getElementsByTagName !== "undefined" ) {
1189
1264
  return context.getElementsByTagName( tag );
@@ -1198,12 +1273,13 @@ setDocument = Sizzle.setDocument = function( node ) {
1198
1273
  var elem,
1199
1274
  tmp = [],
1200
1275
  i = 0,
1276
+
1201
1277
  // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too
1202
1278
  results = context.getElementsByTagName( tag );
1203
1279
 
1204
1280
  // Filter out possible comments
1205
1281
  if ( tag === "*" ) {
1206
- while ( (elem = results[i++]) ) {
1282
+ while ( ( elem = results[ i++ ] ) ) {
1207
1283
  if ( elem.nodeType === 1 ) {
1208
1284
  tmp.push( elem );
1209
1285
  }
@@ -1215,7 +1291,7 @@ setDocument = Sizzle.setDocument = function( node ) {
1215
1291
  };
1216
1292
 
1217
1293
  // Class
1218
- Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) {
1294
+ Expr.find[ "CLASS" ] = support.getElementsByClassName && function( className, context ) {
1219
1295
  if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) {
1220
1296
  return context.getElementsByClassName( className );
1221
1297
  }
@@ -1236,10 +1312,14 @@ setDocument = Sizzle.setDocument = function( node ) {
1236
1312
  // See https://bugs.jquery.com/ticket/13378
1237
1313
  rbuggyQSA = [];
1238
1314
 
1239
- if ( (support.qsa = rnative.test( document.querySelectorAll )) ) {
1315
+ if ( ( support.qsa = rnative.test( document.querySelectorAll ) ) ) {
1316
+
1240
1317
  // Build QSA regex
1241
1318
  // Regex strategy adopted from Diego Perini
1242
- assert(function( el ) {
1319
+ assert( function( el ) {
1320
+
1321
+ var input;
1322
+
1243
1323
  // Select is set to empty string on purpose
1244
1324
  // This is to test IE's treatment of not explicitly
1245
1325
  // setting a boolean content attribute,
@@ -1253,78 +1333,98 @@ setDocument = Sizzle.setDocument = function( node ) {
1253
1333
  // Nothing should be selected when empty strings follow ^= or $= or *=
1254
1334
  // The test attribute must be unknown in Opera but "safe" for WinRT
1255
1335
  // https://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section
1256
- if ( el.querySelectorAll("[msallowcapture^='']").length ) {
1336
+ if ( el.querySelectorAll( "[msallowcapture^='']" ).length ) {
1257
1337
  rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" );
1258
1338
  }
1259
1339
 
1260
1340
  // Support: IE8
1261
1341
  // Boolean attributes and "value" are not treated correctly
1262
- if ( !el.querySelectorAll("[selected]").length ) {
1342
+ if ( !el.querySelectorAll( "[selected]" ).length ) {
1263
1343
  rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" );
1264
1344
  }
1265
1345
 
1266
1346
  // Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+
1267
1347
  if ( !el.querySelectorAll( "[id~=" + expando + "-]" ).length ) {
1268
- 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 + "*(?:''|\"\")" );
1269
1362
  }
1270
1363
 
1271
1364
  // Webkit/Opera - :checked should return selected option elements
1272
1365
  // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
1273
1366
  // IE8 throws error here and will not see later tests
1274
- if ( !el.querySelectorAll(":checked").length ) {
1275
- rbuggyQSA.push(":checked");
1367
+ if ( !el.querySelectorAll( ":checked" ).length ) {
1368
+ rbuggyQSA.push( ":checked" );
1276
1369
  }
1277
1370
 
1278
1371
  // Support: Safari 8+, iOS 8+
1279
1372
  // https://bugs.webkit.org/show_bug.cgi?id=136851
1280
1373
  // In-page `selector#id sibling-combinator selector` fails
1281
1374
  if ( !el.querySelectorAll( "a#" + expando + "+*" ).length ) {
1282
- rbuggyQSA.push(".#.+[+~]");
1375
+ rbuggyQSA.push( ".#.+[+~]" );
1283
1376
  }
1284
- });
1285
1377
 
1286
- 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 ) {
1287
1385
  el.innerHTML = "<a href='' disabled='disabled'></a>" +
1288
1386
  "<select disabled='disabled'><option/></select>";
1289
1387
 
1290
1388
  // Support: Windows 8 Native Apps
1291
1389
  // The type and name attributes are restricted during .innerHTML assignment
1292
- var input = document.createElement("input");
1390
+ var input = document.createElement( "input" );
1293
1391
  input.setAttribute( "type", "hidden" );
1294
1392
  el.appendChild( input ).setAttribute( "name", "D" );
1295
1393
 
1296
1394
  // Support: IE8
1297
1395
  // Enforce case-sensitivity of name attribute
1298
- if ( el.querySelectorAll("[name=d]").length ) {
1396
+ if ( el.querySelectorAll( "[name=d]" ).length ) {
1299
1397
  rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" );
1300
1398
  }
1301
1399
 
1302
1400
  // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
1303
1401
  // IE8 throws error here and will not see later tests
1304
- if ( el.querySelectorAll(":enabled").length !== 2 ) {
1402
+ if ( el.querySelectorAll( ":enabled" ).length !== 2 ) {
1305
1403
  rbuggyQSA.push( ":enabled", ":disabled" );
1306
1404
  }
1307
1405
 
1308
1406
  // Support: IE9-11+
1309
1407
  // IE's :disabled selector does not pick up the children of disabled fieldsets
1310
1408
  docElem.appendChild( el ).disabled = true;
1311
- if ( el.querySelectorAll(":disabled").length !== 2 ) {
1409
+ if ( el.querySelectorAll( ":disabled" ).length !== 2 ) {
1312
1410
  rbuggyQSA.push( ":enabled", ":disabled" );
1313
1411
  }
1314
1412
 
1413
+ // Support: Opera 10 - 11 only
1315
1414
  // Opera 10-11 does not throw on post-comma invalid pseudos
1316
- el.querySelectorAll("*,:x");
1317
- rbuggyQSA.push(",.*:");
1318
- });
1415
+ el.querySelectorAll( "*,:x" );
1416
+ rbuggyQSA.push( ",.*:" );
1417
+ } );
1319
1418
  }
1320
1419
 
1321
- if ( (support.matchesSelector = rnative.test( (matches = docElem.matches ||
1420
+ if ( ( support.matchesSelector = rnative.test( ( matches = docElem.matches ||
1322
1421
  docElem.webkitMatchesSelector ||
1323
1422
  docElem.mozMatchesSelector ||
1324
1423
  docElem.oMatchesSelector ||
1325
- docElem.msMatchesSelector) )) ) {
1424
+ docElem.msMatchesSelector ) ) ) ) {
1425
+
1426
+ assert( function( el ) {
1326
1427
 
1327
- assert(function( el ) {
1328
1428
  // Check to see if it's possible to do matchesSelector
1329
1429
  // on a disconnected node (IE 9)
1330
1430
  support.disconnectedMatch = matches.call( el, "*" );
@@ -1333,11 +1433,11 @@ setDocument = Sizzle.setDocument = function( node ) {
1333
1433
  // Gecko does not error, returns false instead
1334
1434
  matches.call( el, "[s!='']:x" );
1335
1435
  rbuggyMatches.push( "!=", pseudos );
1336
- });
1436
+ } );
1337
1437
  }
1338
1438
 
1339
- rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") );
1340
- rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") );
1439
+ rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join( "|" ) );
1440
+ rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join( "|" ) );
1341
1441
 
1342
1442
  /* Contains
1343
1443
  ---------------------------------------------------------------------- */
@@ -1354,11 +1454,11 @@ setDocument = Sizzle.setDocument = function( node ) {
1354
1454
  adown.contains ?
1355
1455
  adown.contains( bup ) :
1356
1456
  a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
1357
- ));
1457
+ ) );
1358
1458
  } :
1359
1459
  function( a, b ) {
1360
1460
  if ( b ) {
1361
- while ( (b = b.parentNode) ) {
1461
+ while ( ( b = b.parentNode ) ) {
1362
1462
  if ( b === a ) {
1363
1463
  return true;
1364
1464
  }
@@ -1387,7 +1487,11 @@ setDocument = Sizzle.setDocument = function( node ) {
1387
1487
  }
1388
1488
 
1389
1489
  // Calculate position if both inputs belong to the same document
1390
- 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 ) ?
1391
1495
  a.compareDocumentPosition( b ) :
1392
1496
 
1393
1497
  // Otherwise we know they are disconnected
@@ -1395,13 +1499,24 @@ setDocument = Sizzle.setDocument = function( node ) {
1395
1499
 
1396
1500
  // Disconnected nodes
1397
1501
  if ( compare & 1 ||
1398
- (!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) {
1502
+ ( !support.sortDetached && b.compareDocumentPosition( a ) === compare ) ) {
1399
1503
 
1400
1504
  // Choose the first element that is related to our preferred document
1401
- 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 ) ) {
1402
1511
  return -1;
1403
1512
  }
1404
- 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 ) ) {
1405
1520
  return 1;
1406
1521
  }
1407
1522
 
@@ -1414,6 +1529,7 @@ setDocument = Sizzle.setDocument = function( node ) {
1414
1529
  return compare & 4 ? -1 : 1;
1415
1530
  } :
1416
1531
  function( a, b ) {
1532
+
1417
1533
  // Exit early if the nodes are identical
1418
1534
  if ( a === b ) {
1419
1535
  hasDuplicate = true;
@@ -1429,8 +1545,14 @@ setDocument = Sizzle.setDocument = function( node ) {
1429
1545
 
1430
1546
  // Parentless nodes are either documents or disconnected
1431
1547
  if ( !aup || !bup ) {
1432
- return a === document ? -1 :
1433
- 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 */
1434
1556
  aup ? -1 :
1435
1557
  bup ? 1 :
1436
1558
  sortInput ?
@@ -1444,26 +1566,32 @@ setDocument = Sizzle.setDocument = function( node ) {
1444
1566
 
1445
1567
  // Otherwise we need full lists of their ancestors for comparison
1446
1568
  cur = a;
1447
- while ( (cur = cur.parentNode) ) {
1569
+ while ( ( cur = cur.parentNode ) ) {
1448
1570
  ap.unshift( cur );
1449
1571
  }
1450
1572
  cur = b;
1451
- while ( (cur = cur.parentNode) ) {
1573
+ while ( ( cur = cur.parentNode ) ) {
1452
1574
  bp.unshift( cur );
1453
1575
  }
1454
1576
 
1455
1577
  // Walk down the tree looking for a discrepancy
1456
- while ( ap[i] === bp[i] ) {
1578
+ while ( ap[ i ] === bp[ i ] ) {
1457
1579
  i++;
1458
1580
  }
1459
1581
 
1460
1582
  return i ?
1583
+
1461
1584
  // Do a sibling check if the nodes have a common ancestor
1462
- siblingCheck( ap[i], bp[i] ) :
1585
+ siblingCheck( ap[ i ], bp[ i ] ) :
1463
1586
 
1464
1587
  // Otherwise nodes in our document sort first
1465
- ap[i] === preferredDoc ? -1 :
1466
- 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 */
1467
1595
  0;
1468
1596
  };
1469
1597
 
@@ -1475,16 +1603,10 @@ Sizzle.matches = function( expr, elements ) {
1475
1603
  };
1476
1604
 
1477
1605
  Sizzle.matchesSelector = function( elem, expr ) {
1478
- // Set document vars if needed
1479
- if ( ( elem.ownerDocument || elem ) !== document ) {
1480
- setDocument( elem );
1481
- }
1482
-
1483
- // Make sure that attribute selectors are quoted
1484
- expr = expr.replace( rattributeQuotes, "='$1']" );
1606
+ setDocument( elem );
1485
1607
 
1486
1608
  if ( support.matchesSelector && documentIsHTML &&
1487
- !compilerCache[ expr + " " ] &&
1609
+ !nonnativeSelectorCache[ expr + " " ] &&
1488
1610
  ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) &&
1489
1611
  ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) {
1490
1612
 
@@ -1493,32 +1615,46 @@ Sizzle.matchesSelector = function( elem, expr ) {
1493
1615
 
1494
1616
  // IE 9's matchesSelector returns false on disconnected nodes
1495
1617
  if ( ret || support.disconnectedMatch ||
1496
- // As well, disconnected nodes are said to be in a document
1497
- // fragment in IE 9
1498
- 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 ) {
1499
1622
  return ret;
1500
1623
  }
1501
- } catch (e) {}
1624
+ } catch ( e ) {
1625
+ nonnativeSelectorCache( expr, true );
1626
+ }
1502
1627
  }
1503
1628
 
1504
1629
  return Sizzle( expr, document, null, [ elem ] ).length > 0;
1505
1630
  };
1506
1631
 
1507
1632
  Sizzle.contains = function( context, elem ) {
1633
+
1508
1634
  // Set document vars if needed
1509
- 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 ) {
1510
1640
  setDocument( context );
1511
1641
  }
1512
1642
  return contains( context, elem );
1513
1643
  };
1514
1644
 
1515
1645
  Sizzle.attr = function( elem, name ) {
1646
+
1516
1647
  // Set document vars if needed
1517
- 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 ) {
1518
1653
  setDocument( elem );
1519
1654
  }
1520
1655
 
1521
1656
  var fn = Expr.attrHandle[ name.toLowerCase() ],
1657
+
1522
1658
  // Don't get fooled by Object.prototype properties (jQuery #13807)
1523
1659
  val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ?
1524
1660
  fn( elem, name, !documentIsHTML ) :
@@ -1528,13 +1664,13 @@ Sizzle.attr = function( elem, name ) {
1528
1664
  val :
1529
1665
  support.attributes || !documentIsHTML ?
1530
1666
  elem.getAttribute( name ) :
1531
- (val = elem.getAttributeNode(name)) && val.specified ?
1667
+ ( val = elem.getAttributeNode( name ) ) && val.specified ?
1532
1668
  val.value :
1533
1669
  null;
1534
1670
  };
1535
1671
 
1536
1672
  Sizzle.escape = function( sel ) {
1537
- return (sel + "").replace( rcssescape, fcssescape );
1673
+ return ( sel + "" ).replace( rcssescape, fcssescape );
1538
1674
  };
1539
1675
 
1540
1676
  Sizzle.error = function( msg ) {
@@ -1557,7 +1693,7 @@ Sizzle.uniqueSort = function( results ) {
1557
1693
  results.sort( sortOrder );
1558
1694
 
1559
1695
  if ( hasDuplicate ) {
1560
- while ( (elem = results[i++]) ) {
1696
+ while ( ( elem = results[ i++ ] ) ) {
1561
1697
  if ( elem === results[ i ] ) {
1562
1698
  j = duplicates.push( i );
1563
1699
  }
@@ -1585,17 +1721,21 @@ getText = Sizzle.getText = function( elem ) {
1585
1721
  nodeType = elem.nodeType;
1586
1722
 
1587
1723
  if ( !nodeType ) {
1724
+
1588
1725
  // If no nodeType, this is expected to be an array
1589
- while ( (node = elem[i++]) ) {
1726
+ while ( ( node = elem[ i++ ] ) ) {
1727
+
1590
1728
  // Do not traverse comment nodes
1591
1729
  ret += getText( node );
1592
1730
  }
1593
1731
  } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
1732
+
1594
1733
  // Use textContent for elements
1595
1734
  // innerText usage removed for consistency of new lines (jQuery #11153)
1596
1735
  if ( typeof elem.textContent === "string" ) {
1597
1736
  return elem.textContent;
1598
1737
  } else {
1738
+
1599
1739
  // Traverse its children
1600
1740
  for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
1601
1741
  ret += getText( elem );
@@ -1604,6 +1744,7 @@ getText = Sizzle.getText = function( elem ) {
1604
1744
  } else if ( nodeType === 3 || nodeType === 4 ) {
1605
1745
  return elem.nodeValue;
1606
1746
  }
1747
+
1607
1748
  // Do not include comment or processing instruction nodes
1608
1749
 
1609
1750
  return ret;
@@ -1631,19 +1772,21 @@ Expr = Sizzle.selectors = {
1631
1772
 
1632
1773
  preFilter: {
1633
1774
  "ATTR": function( match ) {
1634
- match[1] = match[1].replace( runescape, funescape );
1775
+ match[ 1 ] = match[ 1 ].replace( runescape, funescape );
1635
1776
 
1636
1777
  // Move the given value to match[3] whether quoted or unquoted
1637
- match[3] = ( match[3] || match[4] || match[5] || "" ).replace( runescape, funescape );
1778
+ match[ 3 ] = ( match[ 3 ] || match[ 4 ] ||
1779
+ match[ 5 ] || "" ).replace( runescape, funescape );
1638
1780
 
1639
- if ( match[2] === "~=" ) {
1640
- match[3] = " " + match[3] + " ";
1781
+ if ( match[ 2 ] === "~=" ) {
1782
+ match[ 3 ] = " " + match[ 3 ] + " ";
1641
1783
  }
1642
1784
 
1643
1785
  return match.slice( 0, 4 );
1644
1786
  },
1645
1787
 
1646
1788
  "CHILD": function( match ) {
1789
+
1647
1790
  /* matches from matchExpr["CHILD"]
1648
1791
  1 type (only|nth|...)
1649
1792
  2 what (child|of-type)
@@ -1654,22 +1797,25 @@ Expr = Sizzle.selectors = {
1654
1797
  7 sign of y-component
1655
1798
  8 y of y-component
1656
1799
  */
1657
- match[1] = match[1].toLowerCase();
1800
+ match[ 1 ] = match[ 1 ].toLowerCase();
1801
+
1802
+ if ( match[ 1 ].slice( 0, 3 ) === "nth" ) {
1658
1803
 
1659
- if ( match[1].slice( 0, 3 ) === "nth" ) {
1660
1804
  // nth-* requires argument
1661
- if ( !match[3] ) {
1662
- Sizzle.error( match[0] );
1805
+ if ( !match[ 3 ] ) {
1806
+ Sizzle.error( match[ 0 ] );
1663
1807
  }
1664
1808
 
1665
1809
  // numeric x and y parameters for Expr.filter.CHILD
1666
1810
  // remember that false/true cast respectively to 0/1
1667
- match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) );
1668
- 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" );
1669
1815
 
1670
- // other types prohibit arguments
1671
- } else if ( match[3] ) {
1672
- Sizzle.error( match[0] );
1816
+ // other types prohibit arguments
1817
+ } else if ( match[ 3 ] ) {
1818
+ Sizzle.error( match[ 0 ] );
1673
1819
  }
1674
1820
 
1675
1821
  return match;
@@ -1677,26 +1823,28 @@ Expr = Sizzle.selectors = {
1677
1823
 
1678
1824
  "PSEUDO": function( match ) {
1679
1825
  var excess,
1680
- unquoted = !match[6] && match[2];
1826
+ unquoted = !match[ 6 ] && match[ 2 ];
1681
1827
 
1682
- if ( matchExpr["CHILD"].test( match[0] ) ) {
1828
+ if ( matchExpr[ "CHILD" ].test( match[ 0 ] ) ) {
1683
1829
  return null;
1684
1830
  }
1685
1831
 
1686
1832
  // Accept quoted arguments as-is
1687
- if ( match[3] ) {
1688
- match[2] = match[4] || match[5] || "";
1833
+ if ( match[ 3 ] ) {
1834
+ match[ 2 ] = match[ 4 ] || match[ 5 ] || "";
1689
1835
 
1690
1836
  // Strip excess characters from unquoted arguments
1691
1837
  } else if ( unquoted && rpseudo.test( unquoted ) &&
1838
+
1692
1839
  // Get excess from tokenize (recursively)
1693
- (excess = tokenize( unquoted, true )) &&
1840
+ ( excess = tokenize( unquoted, true ) ) &&
1841
+
1694
1842
  // advance to the next closing parenthesis
1695
- (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) {
1843
+ ( excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length ) ) {
1696
1844
 
1697
1845
  // excess is a negative index
1698
- match[0] = match[0].slice( 0, excess );
1699
- match[2] = unquoted.slice( 0, excess );
1846
+ match[ 0 ] = match[ 0 ].slice( 0, excess );
1847
+ match[ 2 ] = unquoted.slice( 0, excess );
1700
1848
  }
1701
1849
 
1702
1850
  // Return only captures needed by the pseudo filter method (type and argument)
@@ -1709,7 +1857,9 @@ Expr = Sizzle.selectors = {
1709
1857
  "TAG": function( nodeNameSelector ) {
1710
1858
  var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase();
1711
1859
  return nodeNameSelector === "*" ?
1712
- function() { return true; } :
1860
+ function() {
1861
+ return true;
1862
+ } :
1713
1863
  function( elem ) {
1714
1864
  return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
1715
1865
  };
@@ -1719,10 +1869,16 @@ Expr = Sizzle.selectors = {
1719
1869
  var pattern = classCache[ className + " " ];
1720
1870
 
1721
1871
  return pattern ||
1722
- (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) &&
1723
- classCache( className, function( elem ) {
1724
- return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "" );
1725
- });
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
+ } );
1726
1882
  },
1727
1883
 
1728
1884
  "ATTR": function( name, operator, check ) {
@@ -1738,6 +1894,8 @@ Expr = Sizzle.selectors = {
1738
1894
 
1739
1895
  result += "";
1740
1896
 
1897
+ /* eslint-disable max-len */
1898
+
1741
1899
  return operator === "=" ? result === check :
1742
1900
  operator === "!=" ? result !== check :
1743
1901
  operator === "^=" ? check && result.indexOf( check ) === 0 :
@@ -1746,10 +1904,12 @@ Expr = Sizzle.selectors = {
1746
1904
  operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 :
1747
1905
  operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" :
1748
1906
  false;
1907
+ /* eslint-enable max-len */
1908
+
1749
1909
  };
1750
1910
  },
1751
1911
 
1752
- "CHILD": function( type, what, argument, first, last ) {
1912
+ "CHILD": function( type, what, _argument, first, last ) {
1753
1913
  var simple = type.slice( 0, 3 ) !== "nth",
1754
1914
  forward = type.slice( -4 ) !== "last",
1755
1915
  ofType = what === "of-type";
@@ -1761,7 +1921,7 @@ Expr = Sizzle.selectors = {
1761
1921
  return !!elem.parentNode;
1762
1922
  } :
1763
1923
 
1764
- function( elem, context, xml ) {
1924
+ function( elem, _context, xml ) {
1765
1925
  var cache, uniqueCache, outerCache, node, nodeIndex, start,
1766
1926
  dir = simple !== forward ? "nextSibling" : "previousSibling",
1767
1927
  parent = elem.parentNode,
@@ -1775,7 +1935,7 @@ Expr = Sizzle.selectors = {
1775
1935
  if ( simple ) {
1776
1936
  while ( dir ) {
1777
1937
  node = elem;
1778
- while ( (node = node[ dir ]) ) {
1938
+ while ( ( node = node[ dir ] ) ) {
1779
1939
  if ( ofType ?
1780
1940
  node.nodeName.toLowerCase() === name :
1781
1941
  node.nodeType === 1 ) {
@@ -1783,6 +1943,7 @@ Expr = Sizzle.selectors = {
1783
1943
  return false;
1784
1944
  }
1785
1945
  }
1946
+
1786
1947
  // Reverse direction for :only-* (if we haven't yet done so)
1787
1948
  start = dir = type === "only" && !start && "nextSibling";
1788
1949
  }
@@ -1798,22 +1959,22 @@ Expr = Sizzle.selectors = {
1798
1959
 
1799
1960
  // ...in a gzip-friendly way
1800
1961
  node = parent;
1801
- outerCache = node[ expando ] || (node[ expando ] = {});
1962
+ outerCache = node[ expando ] || ( node[ expando ] = {} );
1802
1963
 
1803
1964
  // Support: IE <9 only
1804
1965
  // Defend against cloned attroperties (jQuery gh-1709)
1805
1966
  uniqueCache = outerCache[ node.uniqueID ] ||
1806
- (outerCache[ node.uniqueID ] = {});
1967
+ ( outerCache[ node.uniqueID ] = {} );
1807
1968
 
1808
1969
  cache = uniqueCache[ type ] || [];
1809
1970
  nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
1810
1971
  diff = nodeIndex && cache[ 2 ];
1811
1972
  node = nodeIndex && parent.childNodes[ nodeIndex ];
1812
1973
 
1813
- while ( (node = ++nodeIndex && node && node[ dir ] ||
1974
+ while ( ( node = ++nodeIndex && node && node[ dir ] ||
1814
1975
 
1815
1976
  // Fallback to seeking `elem` from the start
1816
- (diff = nodeIndex = 0) || start.pop()) ) {
1977
+ ( diff = nodeIndex = 0 ) || start.pop() ) ) {
1817
1978
 
1818
1979
  // When found, cache indexes on `parent` and break
1819
1980
  if ( node.nodeType === 1 && ++diff && node === elem ) {
@@ -1823,16 +1984,18 @@ Expr = Sizzle.selectors = {
1823
1984
  }
1824
1985
 
1825
1986
  } else {
1987
+
1826
1988
  // Use previously-cached element index if available
1827
1989
  if ( useCache ) {
1990
+
1828
1991
  // ...in a gzip-friendly way
1829
1992
  node = elem;
1830
- outerCache = node[ expando ] || (node[ expando ] = {});
1993
+ outerCache = node[ expando ] || ( node[ expando ] = {} );
1831
1994
 
1832
1995
  // Support: IE <9 only
1833
1996
  // Defend against cloned attroperties (jQuery gh-1709)
1834
1997
  uniqueCache = outerCache[ node.uniqueID ] ||
1835
- (outerCache[ node.uniqueID ] = {});
1998
+ ( outerCache[ node.uniqueID ] = {} );
1836
1999
 
1837
2000
  cache = uniqueCache[ type ] || [];
1838
2001
  nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
@@ -1842,9 +2005,10 @@ Expr = Sizzle.selectors = {
1842
2005
  // xml :nth-child(...)
1843
2006
  // or :nth-last-child(...) or :nth(-last)?-of-type(...)
1844
2007
  if ( diff === false ) {
2008
+
1845
2009
  // Use the same loop as above to seek `elem` from the start
1846
- while ( (node = ++nodeIndex && node && node[ dir ] ||
1847
- (diff = nodeIndex = 0) || start.pop()) ) {
2010
+ while ( ( node = ++nodeIndex && node && node[ dir ] ||
2011
+ ( diff = nodeIndex = 0 ) || start.pop() ) ) {
1848
2012
 
1849
2013
  if ( ( ofType ?
1850
2014
  node.nodeName.toLowerCase() === name :
@@ -1853,12 +2017,13 @@ Expr = Sizzle.selectors = {
1853
2017
 
1854
2018
  // Cache the index of each encountered element
1855
2019
  if ( useCache ) {
1856
- outerCache = node[ expando ] || (node[ expando ] = {});
2020
+ outerCache = node[ expando ] ||
2021
+ ( node[ expando ] = {} );
1857
2022
 
1858
2023
  // Support: IE <9 only
1859
2024
  // Defend against cloned attroperties (jQuery gh-1709)
1860
2025
  uniqueCache = outerCache[ node.uniqueID ] ||
1861
- (outerCache[ node.uniqueID ] = {});
2026
+ ( outerCache[ node.uniqueID ] = {} );
1862
2027
 
1863
2028
  uniqueCache[ type ] = [ dirruns, diff ];
1864
2029
  }
@@ -1879,6 +2044,7 @@ Expr = Sizzle.selectors = {
1879
2044
  },
1880
2045
 
1881
2046
  "PSEUDO": function( pseudo, argument ) {
2047
+
1882
2048
  // pseudo-class names are case-insensitive
1883
2049
  // http://www.w3.org/TR/selectors/#pseudo-classes
1884
2050
  // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
@@ -1898,15 +2064,15 @@ Expr = Sizzle.selectors = {
1898
2064
  if ( fn.length > 1 ) {
1899
2065
  args = [ pseudo, pseudo, "", argument ];
1900
2066
  return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?
1901
- markFunction(function( seed, matches ) {
2067
+ markFunction( function( seed, matches ) {
1902
2068
  var idx,
1903
2069
  matched = fn( seed, argument ),
1904
2070
  i = matched.length;
1905
2071
  while ( i-- ) {
1906
- idx = indexOf( seed, matched[i] );
1907
- seed[ idx ] = !( matches[ idx ] = matched[i] );
2072
+ idx = indexOf( seed, matched[ i ] );
2073
+ seed[ idx ] = !( matches[ idx ] = matched[ i ] );
1908
2074
  }
1909
- }) :
2075
+ } ) :
1910
2076
  function( elem ) {
1911
2077
  return fn( elem, 0, args );
1912
2078
  };
@@ -1917,8 +2083,10 @@ Expr = Sizzle.selectors = {
1917
2083
  },
1918
2084
 
1919
2085
  pseudos: {
2086
+
1920
2087
  // Potentially complex pseudos
1921
- "not": markFunction(function( selector ) {
2088
+ "not": markFunction( function( selector ) {
2089
+
1922
2090
  // Trim the selector passed to compile
1923
2091
  // to avoid treating leading and trailing
1924
2092
  // spaces as combinators
@@ -1927,39 +2095,40 @@ Expr = Sizzle.selectors = {
1927
2095
  matcher = compile( selector.replace( rtrim, "$1" ) );
1928
2096
 
1929
2097
  return matcher[ expando ] ?
1930
- markFunction(function( seed, matches, context, xml ) {
2098
+ markFunction( function( seed, matches, _context, xml ) {
1931
2099
  var elem,
1932
2100
  unmatched = matcher( seed, null, xml, [] ),
1933
2101
  i = seed.length;
1934
2102
 
1935
2103
  // Match elements unmatched by `matcher`
1936
2104
  while ( i-- ) {
1937
- if ( (elem = unmatched[i]) ) {
1938
- seed[i] = !(matches[i] = elem);
2105
+ if ( ( elem = unmatched[ i ] ) ) {
2106
+ seed[ i ] = !( matches[ i ] = elem );
1939
2107
  }
1940
2108
  }
1941
- }) :
1942
- function( elem, context, xml ) {
1943
- input[0] = elem;
2109
+ } ) :
2110
+ function( elem, _context, xml ) {
2111
+ input[ 0 ] = elem;
1944
2112
  matcher( input, null, xml, results );
2113
+
1945
2114
  // Don't keep the element (issue #299)
1946
- input[0] = null;
2115
+ input[ 0 ] = null;
1947
2116
  return !results.pop();
1948
2117
  };
1949
- }),
2118
+ } ),
1950
2119
 
1951
- "has": markFunction(function( selector ) {
2120
+ "has": markFunction( function( selector ) {
1952
2121
  return function( elem ) {
1953
2122
  return Sizzle( selector, elem ).length > 0;
1954
2123
  };
1955
- }),
2124
+ } ),
1956
2125
 
1957
- "contains": markFunction(function( text ) {
2126
+ "contains": markFunction( function( text ) {
1958
2127
  text = text.replace( runescape, funescape );
1959
2128
  return function( elem ) {
1960
- return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1;
2129
+ return ( elem.textContent || getText( elem ) ).indexOf( text ) > -1;
1961
2130
  };
1962
- }),
2131
+ } ),
1963
2132
 
1964
2133
  // "Whether an element is represented by a :lang() selector
1965
2134
  // is based solely on the element's language value
@@ -1969,25 +2138,26 @@ Expr = Sizzle.selectors = {
1969
2138
  // The identifier C does not have to be a valid language name."
1970
2139
  // http://www.w3.org/TR/selectors/#lang-pseudo
1971
2140
  "lang": markFunction( function( lang ) {
2141
+
1972
2142
  // lang value must be a valid identifier
1973
- if ( !ridentifier.test(lang || "") ) {
2143
+ if ( !ridentifier.test( lang || "" ) ) {
1974
2144
  Sizzle.error( "unsupported lang: " + lang );
1975
2145
  }
1976
2146
  lang = lang.replace( runescape, funescape ).toLowerCase();
1977
2147
  return function( elem ) {
1978
2148
  var elemLang;
1979
2149
  do {
1980
- if ( (elemLang = documentIsHTML ?
2150
+ if ( ( elemLang = documentIsHTML ?
1981
2151
  elem.lang :
1982
- elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) {
2152
+ elem.getAttribute( "xml:lang" ) || elem.getAttribute( "lang" ) ) ) {
1983
2153
 
1984
2154
  elemLang = elemLang.toLowerCase();
1985
2155
  return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0;
1986
2156
  }
1987
- } while ( (elem = elem.parentNode) && elem.nodeType === 1 );
2157
+ } while ( ( elem = elem.parentNode ) && elem.nodeType === 1 );
1988
2158
  return false;
1989
2159
  };
1990
- }),
2160
+ } ),
1991
2161
 
1992
2162
  // Miscellaneous
1993
2163
  "target": function( elem ) {
@@ -2000,7 +2170,9 @@ Expr = Sizzle.selectors = {
2000
2170
  },
2001
2171
 
2002
2172
  "focus": function( elem ) {
2003
- 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 );
2004
2176
  },
2005
2177
 
2006
2178
  // Boolean properties
@@ -2008,16 +2180,20 @@ Expr = Sizzle.selectors = {
2008
2180
  "disabled": createDisabledPseudo( true ),
2009
2181
 
2010
2182
  "checked": function( elem ) {
2183
+
2011
2184
  // In CSS3, :checked should return both checked and selected elements
2012
2185
  // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
2013
2186
  var nodeName = elem.nodeName.toLowerCase();
2014
- return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected);
2187
+ return ( nodeName === "input" && !!elem.checked ) ||
2188
+ ( nodeName === "option" && !!elem.selected );
2015
2189
  },
2016
2190
 
2017
2191
  "selected": function( elem ) {
2192
+
2018
2193
  // Accessing this property makes selected-by-default
2019
2194
  // options in Safari work properly
2020
2195
  if ( elem.parentNode ) {
2196
+ // eslint-disable-next-line no-unused-expressions
2021
2197
  elem.parentNode.selectedIndex;
2022
2198
  }
2023
2199
 
@@ -2026,6 +2202,7 @@ Expr = Sizzle.selectors = {
2026
2202
 
2027
2203
  // Contents
2028
2204
  "empty": function( elem ) {
2205
+
2029
2206
  // http://www.w3.org/TR/selectors/#empty-pseudo
2030
2207
  // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5),
2031
2208
  // but not by others (comment: 8; processing instruction: 7; etc.)
@@ -2039,7 +2216,7 @@ Expr = Sizzle.selectors = {
2039
2216
  },
2040
2217
 
2041
2218
  "parent": function( elem ) {
2042
- return !Expr.pseudos["empty"]( elem );
2219
+ return !Expr.pseudos[ "empty" ]( elem );
2043
2220
  },
2044
2221
 
2045
2222
  // Element/input types
@@ -2063,57 +2240,62 @@ Expr = Sizzle.selectors = {
2063
2240
 
2064
2241
  // Support: IE<8
2065
2242
  // New HTML5 attribute values (e.g., "search") appear with elem.type === "text"
2066
- ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text" );
2243
+ ( ( attr = elem.getAttribute( "type" ) ) == null ||
2244
+ attr.toLowerCase() === "text" );
2067
2245
  },
2068
2246
 
2069
2247
  // Position-in-collection
2070
- "first": createPositionalPseudo(function() {
2248
+ "first": createPositionalPseudo( function() {
2071
2249
  return [ 0 ];
2072
- }),
2250
+ } ),
2073
2251
 
2074
- "last": createPositionalPseudo(function( matchIndexes, length ) {
2252
+ "last": createPositionalPseudo( function( _matchIndexes, length ) {
2075
2253
  return [ length - 1 ];
2076
- }),
2254
+ } ),
2077
2255
 
2078
- "eq": createPositionalPseudo(function( matchIndexes, length, argument ) {
2256
+ "eq": createPositionalPseudo( function( _matchIndexes, length, argument ) {
2079
2257
  return [ argument < 0 ? argument + length : argument ];
2080
- }),
2258
+ } ),
2081
2259
 
2082
- "even": createPositionalPseudo(function( matchIndexes, length ) {
2260
+ "even": createPositionalPseudo( function( matchIndexes, length ) {
2083
2261
  var i = 0;
2084
2262
  for ( ; i < length; i += 2 ) {
2085
2263
  matchIndexes.push( i );
2086
2264
  }
2087
2265
  return matchIndexes;
2088
- }),
2266
+ } ),
2089
2267
 
2090
- "odd": createPositionalPseudo(function( matchIndexes, length ) {
2268
+ "odd": createPositionalPseudo( function( matchIndexes, length ) {
2091
2269
  var i = 1;
2092
2270
  for ( ; i < length; i += 2 ) {
2093
2271
  matchIndexes.push( i );
2094
2272
  }
2095
2273
  return matchIndexes;
2096
- }),
2274
+ } ),
2097
2275
 
2098
- "lt": createPositionalPseudo(function( matchIndexes, length, argument ) {
2099
- var i = argument < 0 ? argument + length : argument;
2276
+ "lt": createPositionalPseudo( function( matchIndexes, length, argument ) {
2277
+ var i = argument < 0 ?
2278
+ argument + length :
2279
+ argument > length ?
2280
+ length :
2281
+ argument;
2100
2282
  for ( ; --i >= 0; ) {
2101
2283
  matchIndexes.push( i );
2102
2284
  }
2103
2285
  return matchIndexes;
2104
- }),
2286
+ } ),
2105
2287
 
2106
- "gt": createPositionalPseudo(function( matchIndexes, length, argument ) {
2288
+ "gt": createPositionalPseudo( function( matchIndexes, length, argument ) {
2107
2289
  var i = argument < 0 ? argument + length : argument;
2108
2290
  for ( ; ++i < length; ) {
2109
2291
  matchIndexes.push( i );
2110
2292
  }
2111
2293
  return matchIndexes;
2112
- })
2294
+ } )
2113
2295
  }
2114
2296
  };
2115
2297
 
2116
- Expr.pseudos["nth"] = Expr.pseudos["eq"];
2298
+ Expr.pseudos[ "nth" ] = Expr.pseudos[ "eq" ];
2117
2299
 
2118
2300
  // Add button/input type pseudos
2119
2301
  for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) {
@@ -2144,37 +2326,39 @@ tokenize = Sizzle.tokenize = function( selector, parseOnly ) {
2144
2326
  while ( soFar ) {
2145
2327
 
2146
2328
  // Comma and first run
2147
- if ( !matched || (match = rcomma.exec( soFar )) ) {
2329
+ if ( !matched || ( match = rcomma.exec( soFar ) ) ) {
2148
2330
  if ( match ) {
2331
+
2149
2332
  // Don't consume trailing commas as valid
2150
- soFar = soFar.slice( match[0].length ) || soFar;
2333
+ soFar = soFar.slice( match[ 0 ].length ) || soFar;
2151
2334
  }
2152
- groups.push( (tokens = []) );
2335
+ groups.push( ( tokens = [] ) );
2153
2336
  }
2154
2337
 
2155
2338
  matched = false;
2156
2339
 
2157
2340
  // Combinators
2158
- if ( (match = rcombinators.exec( soFar )) ) {
2341
+ if ( ( match = rcombinators.exec( soFar ) ) ) {
2159
2342
  matched = match.shift();
2160
- tokens.push({
2343
+ tokens.push( {
2161
2344
  value: matched,
2345
+
2162
2346
  // Cast descendant combinators to space
2163
- type: match[0].replace( rtrim, " " )
2164
- });
2347
+ type: match[ 0 ].replace( rtrim, " " )
2348
+ } );
2165
2349
  soFar = soFar.slice( matched.length );
2166
2350
  }
2167
2351
 
2168
2352
  // Filters
2169
2353
  for ( type in Expr.filter ) {
2170
- if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] ||
2171
- (match = preFilters[ type ]( match ))) ) {
2354
+ if ( ( match = matchExpr[ type ].exec( soFar ) ) && ( !preFilters[ type ] ||
2355
+ ( match = preFilters[ type ]( match ) ) ) ) {
2172
2356
  matched = match.shift();
2173
- tokens.push({
2357
+ tokens.push( {
2174
2358
  value: matched,
2175
2359
  type: type,
2176
2360
  matches: match
2177
- });
2361
+ } );
2178
2362
  soFar = soFar.slice( matched.length );
2179
2363
  }
2180
2364
  }
@@ -2191,6 +2375,7 @@ tokenize = Sizzle.tokenize = function( selector, parseOnly ) {
2191
2375
  soFar.length :
2192
2376
  soFar ?
2193
2377
  Sizzle.error( selector ) :
2378
+
2194
2379
  // Cache the tokens
2195
2380
  tokenCache( selector, groups ).slice( 0 );
2196
2381
  };
@@ -2200,7 +2385,7 @@ function toSelector( tokens ) {
2200
2385
  len = tokens.length,
2201
2386
  selector = "";
2202
2387
  for ( ; i < len; i++ ) {
2203
- selector += tokens[i].value;
2388
+ selector += tokens[ i ].value;
2204
2389
  }
2205
2390
  return selector;
2206
2391
  }
@@ -2213,9 +2398,10 @@ function addCombinator( matcher, combinator, base ) {
2213
2398
  doneName = done++;
2214
2399
 
2215
2400
  return combinator.first ?
2401
+
2216
2402
  // Check against closest ancestor/preceding element
2217
2403
  function( elem, context, xml ) {
2218
- while ( (elem = elem[ dir ]) ) {
2404
+ while ( ( elem = elem[ dir ] ) ) {
2219
2405
  if ( elem.nodeType === 1 || checkNonElements ) {
2220
2406
  return matcher( elem, context, xml );
2221
2407
  }
@@ -2230,7 +2416,7 @@ function addCombinator( matcher, combinator, base ) {
2230
2416
 
2231
2417
  // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching
2232
2418
  if ( xml ) {
2233
- while ( (elem = elem[ dir ]) ) {
2419
+ while ( ( elem = elem[ dir ] ) ) {
2234
2420
  if ( elem.nodeType === 1 || checkNonElements ) {
2235
2421
  if ( matcher( elem, context, xml ) ) {
2236
2422
  return true;
@@ -2238,27 +2424,29 @@ function addCombinator( matcher, combinator, base ) {
2238
2424
  }
2239
2425
  }
2240
2426
  } else {
2241
- while ( (elem = elem[ dir ]) ) {
2427
+ while ( ( elem = elem[ dir ] ) ) {
2242
2428
  if ( elem.nodeType === 1 || checkNonElements ) {
2243
- outerCache = elem[ expando ] || (elem[ expando ] = {});
2429
+ outerCache = elem[ expando ] || ( elem[ expando ] = {} );
2244
2430
 
2245
2431
  // Support: IE <9 only
2246
2432
  // Defend against cloned attroperties (jQuery gh-1709)
2247
- uniqueCache = outerCache[ elem.uniqueID ] || (outerCache[ elem.uniqueID ] = {});
2433
+ uniqueCache = outerCache[ elem.uniqueID ] ||
2434
+ ( outerCache[ elem.uniqueID ] = {} );
2248
2435
 
2249
2436
  if ( skip && skip === elem.nodeName.toLowerCase() ) {
2250
2437
  elem = elem[ dir ] || elem;
2251
- } else if ( (oldCache = uniqueCache[ key ]) &&
2438
+ } else if ( ( oldCache = uniqueCache[ key ] ) &&
2252
2439
  oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) {
2253
2440
 
2254
2441
  // Assign to newCache so results back-propagate to previous elements
2255
- return (newCache[ 2 ] = oldCache[ 2 ]);
2442
+ return ( newCache[ 2 ] = oldCache[ 2 ] );
2256
2443
  } else {
2444
+
2257
2445
  // Reuse newcache so results back-propagate to previous elements
2258
2446
  uniqueCache[ key ] = newCache;
2259
2447
 
2260
2448
  // A match means we're done; a fail means we have to keep checking
2261
- if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) {
2449
+ if ( ( newCache[ 2 ] = matcher( elem, context, xml ) ) ) {
2262
2450
  return true;
2263
2451
  }
2264
2452
  }
@@ -2274,20 +2462,20 @@ function elementMatcher( matchers ) {
2274
2462
  function( elem, context, xml ) {
2275
2463
  var i = matchers.length;
2276
2464
  while ( i-- ) {
2277
- if ( !matchers[i]( elem, context, xml ) ) {
2465
+ if ( !matchers[ i ]( elem, context, xml ) ) {
2278
2466
  return false;
2279
2467
  }
2280
2468
  }
2281
2469
  return true;
2282
2470
  } :
2283
- matchers[0];
2471
+ matchers[ 0 ];
2284
2472
  }
2285
2473
 
2286
2474
  function multipleContexts( selector, contexts, results ) {
2287
2475
  var i = 0,
2288
2476
  len = contexts.length;
2289
2477
  for ( ; i < len; i++ ) {
2290
- Sizzle( selector, contexts[i], results );
2478
+ Sizzle( selector, contexts[ i ], results );
2291
2479
  }
2292
2480
  return results;
2293
2481
  }
@@ -2300,7 +2488,7 @@ function condense( unmatched, map, filter, context, xml ) {
2300
2488
  mapped = map != null;
2301
2489
 
2302
2490
  for ( ; i < len; i++ ) {
2303
- if ( (elem = unmatched[i]) ) {
2491
+ if ( ( elem = unmatched[ i ] ) ) {
2304
2492
  if ( !filter || filter( elem, context, xml ) ) {
2305
2493
  newUnmatched.push( elem );
2306
2494
  if ( mapped ) {
@@ -2320,14 +2508,18 @@ function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postS
2320
2508
  if ( postFinder && !postFinder[ expando ] ) {
2321
2509
  postFinder = setMatcher( postFinder, postSelector );
2322
2510
  }
2323
- return markFunction(function( seed, results, context, xml ) {
2511
+ return markFunction( function( seed, results, context, xml ) {
2324
2512
  var temp, i, elem,
2325
2513
  preMap = [],
2326
2514
  postMap = [],
2327
2515
  preexisting = results.length,
2328
2516
 
2329
2517
  // Get initial elements from seed or context
2330
- elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ),
2518
+ elems = seed || multipleContexts(
2519
+ selector || "*",
2520
+ context.nodeType ? [ context ] : context,
2521
+ []
2522
+ ),
2331
2523
 
2332
2524
  // Prefilter to get matcher input, preserving a map for seed-results synchronization
2333
2525
  matcherIn = preFilter && ( seed || !selector ) ?
@@ -2335,6 +2527,7 @@ function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postS
2335
2527
  elems,
2336
2528
 
2337
2529
  matcherOut = matcher ?
2530
+
2338
2531
  // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
2339
2532
  postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
2340
2533
 
@@ -2358,8 +2551,8 @@ function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postS
2358
2551
  // Un-match failing elements by moving them back to matcherIn
2359
2552
  i = temp.length;
2360
2553
  while ( i-- ) {
2361
- if ( (elem = temp[i]) ) {
2362
- matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem);
2554
+ if ( ( elem = temp[ i ] ) ) {
2555
+ matcherOut[ postMap[ i ] ] = !( matcherIn[ postMap[ i ] ] = elem );
2363
2556
  }
2364
2557
  }
2365
2558
  }
@@ -2367,25 +2560,27 @@ function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postS
2367
2560
  if ( seed ) {
2368
2561
  if ( postFinder || preFilter ) {
2369
2562
  if ( postFinder ) {
2563
+
2370
2564
  // Get the final matcherOut by condensing this intermediate into postFinder contexts
2371
2565
  temp = [];
2372
2566
  i = matcherOut.length;
2373
2567
  while ( i-- ) {
2374
- if ( (elem = matcherOut[i]) ) {
2568
+ if ( ( elem = matcherOut[ i ] ) ) {
2569
+
2375
2570
  // Restore matcherIn since elem is not yet a final match
2376
- temp.push( (matcherIn[i] = elem) );
2571
+ temp.push( ( matcherIn[ i ] = elem ) );
2377
2572
  }
2378
2573
  }
2379
- postFinder( null, (matcherOut = []), temp, xml );
2574
+ postFinder( null, ( matcherOut = [] ), temp, xml );
2380
2575
  }
2381
2576
 
2382
2577
  // Move matched elements from seed to results to keep them synchronized
2383
2578
  i = matcherOut.length;
2384
2579
  while ( i-- ) {
2385
- if ( (elem = matcherOut[i]) &&
2386
- (temp = postFinder ? indexOf( seed, elem ) : preMap[i]) > -1 ) {
2580
+ if ( ( elem = matcherOut[ i ] ) &&
2581
+ ( temp = postFinder ? indexOf( seed, elem ) : preMap[ i ] ) > -1 ) {
2387
2582
 
2388
- seed[temp] = !(results[temp] = elem);
2583
+ seed[ temp ] = !( results[ temp ] = elem );
2389
2584
  }
2390
2585
  }
2391
2586
  }
@@ -2403,14 +2598,14 @@ function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postS
2403
2598
  push.apply( results, matcherOut );
2404
2599
  }
2405
2600
  }
2406
- });
2601
+ } );
2407
2602
  }
2408
2603
 
2409
2604
  function matcherFromTokens( tokens ) {
2410
2605
  var checkContext, matcher, j,
2411
2606
  len = tokens.length,
2412
- leadingRelative = Expr.relative[ tokens[0].type ],
2413
- implicitRelative = leadingRelative || Expr.relative[" "],
2607
+ leadingRelative = Expr.relative[ tokens[ 0 ].type ],
2608
+ implicitRelative = leadingRelative || Expr.relative[ " " ],
2414
2609
  i = leadingRelative ? 1 : 0,
2415
2610
 
2416
2611
  // The foundational matcher ensures that elements are reachable from top-level context(s)
@@ -2422,38 +2617,43 @@ function matcherFromTokens( tokens ) {
2422
2617
  }, implicitRelative, true ),
2423
2618
  matchers = [ function( elem, context, xml ) {
2424
2619
  var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || (
2425
- (checkContext = context).nodeType ?
2620
+ ( checkContext = context ).nodeType ?
2426
2621
  matchContext( elem, context, xml ) :
2427
2622
  matchAnyContext( elem, context, xml ) );
2623
+
2428
2624
  // Avoid hanging onto element (issue #299)
2429
2625
  checkContext = null;
2430
2626
  return ret;
2431
2627
  } ];
2432
2628
 
2433
2629
  for ( ; i < len; i++ ) {
2434
- if ( (matcher = Expr.relative[ tokens[i].type ]) ) {
2435
- matchers = [ addCombinator(elementMatcher( matchers ), matcher) ];
2630
+ if ( ( matcher = Expr.relative[ tokens[ i ].type ] ) ) {
2631
+ matchers = [ addCombinator( elementMatcher( matchers ), matcher ) ];
2436
2632
  } else {
2437
- matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches );
2633
+ matcher = Expr.filter[ tokens[ i ].type ].apply( null, tokens[ i ].matches );
2438
2634
 
2439
2635
  // Return special upon seeing a positional matcher
2440
2636
  if ( matcher[ expando ] ) {
2637
+
2441
2638
  // Find the next relative operator (if any) for proper handling
2442
2639
  j = ++i;
2443
2640
  for ( ; j < len; j++ ) {
2444
- if ( Expr.relative[ tokens[j].type ] ) {
2641
+ if ( Expr.relative[ tokens[ j ].type ] ) {
2445
2642
  break;
2446
2643
  }
2447
2644
  }
2448
2645
  return setMatcher(
2449
2646
  i > 1 && elementMatcher( matchers ),
2450
2647
  i > 1 && toSelector(
2451
- // If the preceding token was a descendant combinator, insert an implicit any-element `*`
2452
- 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 === " " ? "*" : "" } )
2453
2653
  ).replace( rtrim, "$1" ),
2454
2654
  matcher,
2455
2655
  i < j && matcherFromTokens( tokens.slice( i, j ) ),
2456
- j < len && matcherFromTokens( (tokens = tokens.slice( j )) ),
2656
+ j < len && matcherFromTokens( ( tokens = tokens.slice( j ) ) ),
2457
2657
  j < len && toSelector( tokens )
2458
2658
  );
2459
2659
  }
@@ -2474,28 +2674,40 @@ function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
2474
2674
  unmatched = seed && [],
2475
2675
  setMatched = [],
2476
2676
  contextBackup = outermostContext,
2677
+
2477
2678
  // We must always have either seed elements or outermost context
2478
- elems = seed || byElement && Expr.find["TAG"]( "*", outermost ),
2679
+ elems = seed || byElement && Expr.find[ "TAG" ]( "*", outermost ),
2680
+
2479
2681
  // Use integer dirruns iff this is the outermost matcher
2480
- dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1),
2682
+ dirrunsUnique = ( dirruns += contextBackup == null ? 1 : Math.random() || 0.1 ),
2481
2683
  len = elems.length;
2482
2684
 
2483
2685
  if ( outermost ) {
2484
- 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;
2485
2692
  }
2486
2693
 
2487
2694
  // Add elements passing elementMatchers directly to results
2488
2695
  // Support: IE<9, Safari
2489
2696
  // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id
2490
- for ( ; i !== len && (elem = elems[i]) != null; i++ ) {
2697
+ for ( ; i !== len && ( elem = elems[ i ] ) != null; i++ ) {
2491
2698
  if ( byElement && elem ) {
2492
2699
  j = 0;
2493
- 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 ) {
2494
2706
  setDocument( elem );
2495
2707
  xml = !documentIsHTML;
2496
2708
  }
2497
- while ( (matcher = elementMatchers[j++]) ) {
2498
- if ( matcher( elem, context || document, xml) ) {
2709
+ while ( ( matcher = elementMatchers[ j++ ] ) ) {
2710
+ if ( matcher( elem, context || document, xml ) ) {
2499
2711
  results.push( elem );
2500
2712
  break;
2501
2713
  }
@@ -2507,8 +2719,9 @@ function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
2507
2719
 
2508
2720
  // Track unmatched elements for set filters
2509
2721
  if ( bySet ) {
2722
+
2510
2723
  // They will have gone through all possible matchers
2511
- if ( (elem = !matcher && elem) ) {
2724
+ if ( ( elem = !matcher && elem ) ) {
2512
2725
  matchedCount--;
2513
2726
  }
2514
2727
 
@@ -2532,16 +2745,17 @@ function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
2532
2745
  // numerically zero.
2533
2746
  if ( bySet && i !== matchedCount ) {
2534
2747
  j = 0;
2535
- while ( (matcher = setMatchers[j++]) ) {
2748
+ while ( ( matcher = setMatchers[ j++ ] ) ) {
2536
2749
  matcher( unmatched, setMatched, context, xml );
2537
2750
  }
2538
2751
 
2539
2752
  if ( seed ) {
2753
+
2540
2754
  // Reintegrate element matches to eliminate the need for sorting
2541
2755
  if ( matchedCount > 0 ) {
2542
2756
  while ( i-- ) {
2543
- if ( !(unmatched[i] || setMatched[i]) ) {
2544
- setMatched[i] = pop.call( results );
2757
+ if ( !( unmatched[ i ] || setMatched[ i ] ) ) {
2758
+ setMatched[ i ] = pop.call( results );
2545
2759
  }
2546
2760
  }
2547
2761
  }
@@ -2582,13 +2796,14 @@ compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) {
2582
2796
  cached = compilerCache[ selector + " " ];
2583
2797
 
2584
2798
  if ( !cached ) {
2799
+
2585
2800
  // Generate a function of recursive functions that can be used to check each element
2586
2801
  if ( !match ) {
2587
2802
  match = tokenize( selector );
2588
2803
  }
2589
2804
  i = match.length;
2590
2805
  while ( i-- ) {
2591
- cached = matcherFromTokens( match[i] );
2806
+ cached = matcherFromTokens( match[ i ] );
2592
2807
  if ( cached[ expando ] ) {
2593
2808
  setMatchers.push( cached );
2594
2809
  } else {
@@ -2597,7 +2812,10 @@ compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) {
2597
2812
  }
2598
2813
 
2599
2814
  // Cache the compiled function
2600
- cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) );
2815
+ cached = compilerCache(
2816
+ selector,
2817
+ matcherFromGroupMatchers( elementMatchers, setMatchers )
2818
+ );
2601
2819
 
2602
2820
  // Save selector and tokenization
2603
2821
  cached.selector = selector;
@@ -2617,7 +2835,7 @@ compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) {
2617
2835
  select = Sizzle.select = function( selector, context, results, seed ) {
2618
2836
  var i, tokens, token, type, find,
2619
2837
  compiled = typeof selector === "function" && selector,
2620
- match = !seed && tokenize( (selector = compiled.selector || selector) );
2838
+ match = !seed && tokenize( ( selector = compiled.selector || selector ) );
2621
2839
 
2622
2840
  results = results || [];
2623
2841
 
@@ -2626,11 +2844,12 @@ select = Sizzle.select = function( selector, context, results, seed ) {
2626
2844
  if ( match.length === 1 ) {
2627
2845
 
2628
2846
  // Reduce context if the leading compound selector is an ID
2629
- tokens = match[0] = match[0].slice( 0 );
2630
- if ( tokens.length > 2 && (token = tokens[0]).type === "ID" &&
2631
- 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 ] ) {
2632
2850
 
2633
- 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 ];
2634
2853
  if ( !context ) {
2635
2854
  return results;
2636
2855
 
@@ -2643,20 +2862,22 @@ select = Sizzle.select = function( selector, context, results, seed ) {
2643
2862
  }
2644
2863
 
2645
2864
  // Fetch a seed set for right-to-left matching
2646
- i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length;
2865
+ i = matchExpr[ "needsContext" ].test( selector ) ? 0 : tokens.length;
2647
2866
  while ( i-- ) {
2648
- token = tokens[i];
2867
+ token = tokens[ i ];
2649
2868
 
2650
2869
  // Abort if we hit a combinator
2651
- if ( Expr.relative[ (type = token.type) ] ) {
2870
+ if ( Expr.relative[ ( type = token.type ) ] ) {
2652
2871
  break;
2653
2872
  }
2654
- if ( (find = Expr.find[ type ]) ) {
2873
+ if ( ( find = Expr.find[ type ] ) ) {
2874
+
2655
2875
  // Search, expanding context for leading sibling combinators
2656
- if ( (seed = find(
2657
- token.matches[0].replace( runescape, funescape ),
2658
- rsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context
2659
- )) ) {
2876
+ if ( ( seed = find(
2877
+ token.matches[ 0 ].replace( runescape, funescape ),
2878
+ rsibling.test( tokens[ 0 ].type ) && testContext( context.parentNode ) ||
2879
+ context
2880
+ ) ) ) {
2660
2881
 
2661
2882
  // If seed is empty or no tokens remain, we can return early
2662
2883
  tokens.splice( i, 1 );
@@ -2687,7 +2908,7 @@ select = Sizzle.select = function( selector, context, results, seed ) {
2687
2908
  // One-time assignments
2688
2909
 
2689
2910
  // Sort stability
2690
- support.sortStable = expando.split("").sort( sortOrder ).join("") === expando;
2911
+ support.sortStable = expando.split( "" ).sort( sortOrder ).join( "" ) === expando;
2691
2912
 
2692
2913
  // Support: Chrome 14-35+
2693
2914
  // Always assume duplicates if they aren't passed to the comparison function
@@ -2698,58 +2919,59 @@ setDocument();
2698
2919
 
2699
2920
  // Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27)
2700
2921
  // Detached nodes confoundingly follow *each other*
2701
- support.sortDetached = assert(function( el ) {
2922
+ support.sortDetached = assert( function( el ) {
2923
+
2702
2924
  // Should return 1, but returns 4 (following)
2703
- return el.compareDocumentPosition( document.createElement("fieldset") ) & 1;
2704
- });
2925
+ return el.compareDocumentPosition( document.createElement( "fieldset" ) ) & 1;
2926
+ } );
2705
2927
 
2706
2928
  // Support: IE<8
2707
2929
  // Prevent attribute/property "interpolation"
2708
2930
  // https://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
2709
- if ( !assert(function( el ) {
2931
+ if ( !assert( function( el ) {
2710
2932
  el.innerHTML = "<a href='#'></a>";
2711
- return el.firstChild.getAttribute("href") === "#" ;
2712
- }) ) {
2933
+ return el.firstChild.getAttribute( "href" ) === "#";
2934
+ } ) ) {
2713
2935
  addHandle( "type|href|height|width", function( elem, name, isXML ) {
2714
2936
  if ( !isXML ) {
2715
2937
  return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 );
2716
2938
  }
2717
- });
2939
+ } );
2718
2940
  }
2719
2941
 
2720
2942
  // Support: IE<9
2721
2943
  // Use defaultValue in place of getAttribute("value")
2722
- if ( !support.attributes || !assert(function( el ) {
2944
+ if ( !support.attributes || !assert( function( el ) {
2723
2945
  el.innerHTML = "<input/>";
2724
2946
  el.firstChild.setAttribute( "value", "" );
2725
2947
  return el.firstChild.getAttribute( "value" ) === "";
2726
- }) ) {
2727
- addHandle( "value", function( elem, name, isXML ) {
2948
+ } ) ) {
2949
+ addHandle( "value", function( elem, _name, isXML ) {
2728
2950
  if ( !isXML && elem.nodeName.toLowerCase() === "input" ) {
2729
2951
  return elem.defaultValue;
2730
2952
  }
2731
- });
2953
+ } );
2732
2954
  }
2733
2955
 
2734
2956
  // Support: IE<9
2735
2957
  // Use getAttributeNode to fetch booleans when getAttribute lies
2736
- if ( !assert(function( el ) {
2737
- return el.getAttribute("disabled") == null;
2738
- }) ) {
2958
+ if ( !assert( function( el ) {
2959
+ return el.getAttribute( "disabled" ) == null;
2960
+ } ) ) {
2739
2961
  addHandle( booleans, function( elem, name, isXML ) {
2740
2962
  var val;
2741
2963
  if ( !isXML ) {
2742
2964
  return elem[ name ] === true ? name.toLowerCase() :
2743
- (val = elem.getAttributeNode( name )) && val.specified ?
2965
+ ( val = elem.getAttributeNode( name ) ) && val.specified ?
2744
2966
  val.value :
2745
- null;
2967
+ null;
2746
2968
  }
2747
- });
2969
+ } );
2748
2970
  }
2749
2971
 
2750
2972
  return Sizzle;
2751
2973
 
2752
- })( window );
2974
+ } )( window );
2753
2975
 
2754
2976
 
2755
2977
 
@@ -3118,7 +3340,7 @@ jQuery.each( {
3118
3340
  parents: function( elem ) {
3119
3341
  return dir( elem, "parentNode" );
3120
3342
  },
3121
- parentsUntil: function( elem, i, until ) {
3343
+ parentsUntil: function( elem, _i, until ) {
3122
3344
  return dir( elem, "parentNode", until );
3123
3345
  },
3124
3346
  next: function( elem ) {
@@ -3133,10 +3355,10 @@ jQuery.each( {
3133
3355
  prevAll: function( elem ) {
3134
3356
  return dir( elem, "previousSibling" );
3135
3357
  },
3136
- nextUntil: function( elem, i, until ) {
3358
+ nextUntil: function( elem, _i, until ) {
3137
3359
  return dir( elem, "nextSibling", until );
3138
3360
  },
3139
- prevUntil: function( elem, i, until ) {
3361
+ prevUntil: function( elem, _i, until ) {
3140
3362
  return dir( elem, "previousSibling", until );
3141
3363
  },
3142
3364
  siblings: function( elem ) {
@@ -3146,18 +3368,24 @@ jQuery.each( {
3146
3368
  return siblings( elem.firstChild );
3147
3369
  },
3148
3370
  contents: function( elem ) {
3149
- if ( nodeName( elem, "iframe" ) ) {
3150
- return elem.contentDocument;
3151
- }
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 ) ) {
3152
3377
 
3153
- // Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only
3154
- // Treat the template element as a regular one in browsers that
3155
- // don't support it.
3156
- if ( nodeName( elem, "template" ) ) {
3157
- elem = elem.content || elem;
3158
- }
3378
+ return elem.contentDocument;
3379
+ }
3159
3380
 
3160
- return jQuery.merge( [], elem.childNodes );
3381
+ // Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only
3382
+ // Treat the template element as a regular one in browsers that
3383
+ // don't support it.
3384
+ if ( nodeName( elem, "template" ) ) {
3385
+ elem = elem.content || elem;
3386
+ }
3387
+
3388
+ return jQuery.merge( [], elem.childNodes );
3161
3389
  }
3162
3390
  }, function( name, fn ) {
3163
3391
  jQuery.fn[ name ] = function( until, selector ) {
@@ -3489,7 +3717,7 @@ jQuery.extend( {
3489
3717
  var fns = arguments;
3490
3718
 
3491
3719
  return jQuery.Deferred( function( newDefer ) {
3492
- jQuery.each( tuples, function( i, tuple ) {
3720
+ jQuery.each( tuples, function( _i, tuple ) {
3493
3721
 
3494
3722
  // Map tuples (progress, done, fail) to arguments (done, fail, progress)
3495
3723
  var fn = isFunction( fns[ tuple[ 4 ] ] ) && fns[ tuple[ 4 ] ];
@@ -3942,7 +4170,7 @@ var access = function( elems, fn, key, value, chainable, emptyGet, raw ) {
3942
4170
  // ...except when executing function values
3943
4171
  } else {
3944
4172
  bulk = fn;
3945
- fn = function( elem, key, value ) {
4173
+ fn = function( elem, _key, value ) {
3946
4174
  return bulk.call( jQuery( elem ), value );
3947
4175
  };
3948
4176
  }
@@ -3977,7 +4205,7 @@ var rmsPrefix = /^-ms-/,
3977
4205
  rdashAlpha = /-([a-z])/g;
3978
4206
 
3979
4207
  // Used by camelCase as callback to replace()
3980
- function fcamelCase( all, letter ) {
4208
+ function fcamelCase( _all, letter ) {
3981
4209
  return letter.toUpperCase();
3982
4210
  }
3983
4211
 
@@ -4466,6 +4694,26 @@ var rcssNum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" );
4466
4694
 
4467
4695
  var cssExpand = [ "Top", "Right", "Bottom", "Left" ];
4468
4696
 
4697
+ var documentElement = document.documentElement;
4698
+
4699
+
4700
+
4701
+ var isAttached = function( elem ) {
4702
+ return jQuery.contains( elem.ownerDocument, elem );
4703
+ },
4704
+ composed = { composed: true };
4705
+
4706
+ // Support: IE 9 - 11+, Edge 12 - 18+, iOS 10.0 - 10.2 only
4707
+ // Check attachment across shadow DOM boundaries when possible (gh-3504)
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 ) {
4712
+ isAttached = function( elem ) {
4713
+ return jQuery.contains( elem.ownerDocument, elem ) ||
4714
+ elem.getRootNode( composed ) === elem.ownerDocument;
4715
+ };
4716
+ }
4469
4717
  var isHiddenWithinTree = function( elem, el ) {
4470
4718
 
4471
4719
  // isHiddenWithinTree might be called from jQuery#filter function;
@@ -4480,32 +4728,11 @@ var isHiddenWithinTree = function( elem, el ) {
4480
4728
  // Support: Firefox <=43 - 45
4481
4729
  // Disconnected elements can have computed display: none, so first confirm that elem is
4482
4730
  // in the document.
4483
- jQuery.contains( elem.ownerDocument, elem ) &&
4731
+ isAttached( elem ) &&
4484
4732
 
4485
4733
  jQuery.css( elem, "display" ) === "none";
4486
4734
  };
4487
4735
 
4488
- var swap = function( elem, options, callback, args ) {
4489
- var ret, name,
4490
- old = {};
4491
-
4492
- // Remember the old values, and insert the new ones
4493
- for ( name in options ) {
4494
- old[ name ] = elem.style[ name ];
4495
- elem.style[ name ] = options[ name ];
4496
- }
4497
-
4498
- ret = callback.apply( elem, args || [] );
4499
-
4500
- // Revert the old values
4501
- for ( name in options ) {
4502
- elem.style[ name ] = old[ name ];
4503
- }
4504
-
4505
- return ret;
4506
- };
4507
-
4508
-
4509
4736
 
4510
4737
 
4511
4738
  function adjustCSS( elem, prop, valueParts, tween ) {
@@ -4522,7 +4749,8 @@ function adjustCSS( elem, prop, valueParts, tween ) {
4522
4749
  unit = valueParts && valueParts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ),
4523
4750
 
4524
4751
  // Starting value computation is required for potential unit mismatches
4525
- initialInUnit = ( jQuery.cssNumber[ prop ] || unit !== "px" && +initial ) &&
4752
+ initialInUnit = elem.nodeType &&
4753
+ ( jQuery.cssNumber[ prop ] || unit !== "px" && +initial ) &&
4526
4754
  rcssNum.exec( jQuery.css( elem, prop ) );
4527
4755
 
4528
4756
  if ( initialInUnit && initialInUnit[ 3 ] !== unit ) {
@@ -4669,17 +4897,46 @@ jQuery.fn.extend( {
4669
4897
  } );
4670
4898
  var rcheckableType = ( /^(?:checkbox|radio)$/i );
4671
4899
 
4672
- var rtagName = ( /<([a-z][^\/\0>\x20\t\r\n\f]+)/i );
4900
+ var rtagName = ( /<([a-z][^\/\0>\x20\t\r\n\f]*)/i );
4673
4901
 
4674
4902
  var rscriptType = ( /^$|^module$|\/(?:java|ecma)script/i );
4675
4903
 
4676
4904
 
4677
4905
 
4678
- // We have to close these tags to support XHTML (#13200)
4679
- 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;
4680
4929
 
4681
4930
  // Support: IE <=9 only
4682
- 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 = {
4683
4940
 
4684
4941
  // XHTML parsers do not magically insert elements in the
4685
4942
  // same way that tag soup parsers do. So we cannot shorten
@@ -4692,12 +4949,14 @@ var wrapMap = {
4692
4949
  _default: [ 0, "", "" ]
4693
4950
  };
4694
4951
 
4695
- // Support: IE <=9 only
4696
- wrapMap.optgroup = wrapMap.option;
4697
-
4698
4952
  wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
4699
4953
  wrapMap.th = wrapMap.td;
4700
4954
 
4955
+ // Support: IE <=9 only
4956
+ if ( !support.option ) {
4957
+ wrapMap.optgroup = wrapMap.option = [ 1, "<select multiple='multiple'>", "</select>" ];
4958
+ }
4959
+
4701
4960
 
4702
4961
  function getAll( context, tag ) {
4703
4962
 
@@ -4741,7 +5000,7 @@ function setGlobalEval( elems, refElements ) {
4741
5000
  var rhtml = /<|&#?\w+;/;
4742
5001
 
4743
5002
  function buildFragment( elems, context, scripts, selection, ignored ) {
4744
- var elem, tmp, tag, wrap, contains, j,
5003
+ var elem, tmp, tag, wrap, attached, j,
4745
5004
  fragment = context.createDocumentFragment(),
4746
5005
  nodes = [],
4747
5006
  i = 0,
@@ -4805,13 +5064,13 @@ function buildFragment( elems, context, scripts, selection, ignored ) {
4805
5064
  continue;
4806
5065
  }
4807
5066
 
4808
- contains = jQuery.contains( elem.ownerDocument, elem );
5067
+ attached = isAttached( elem );
4809
5068
 
4810
5069
  // Append to fragment
4811
5070
  tmp = getAll( fragment.appendChild( elem ), "script" );
4812
5071
 
4813
5072
  // Preserve script evaluation history
4814
- if ( contains ) {
5073
+ if ( attached ) {
4815
5074
  setGlobalEval( tmp );
4816
5075
  }
4817
5076
 
@@ -4830,34 +5089,6 @@ function buildFragment( elems, context, scripts, selection, ignored ) {
4830
5089
  }
4831
5090
 
4832
5091
 
4833
- ( function() {
4834
- var fragment = document.createDocumentFragment(),
4835
- div = fragment.appendChild( document.createElement( "div" ) ),
4836
- input = document.createElement( "input" );
4837
-
4838
- // Support: Android 4.0 - 4.3 only
4839
- // Check state lost if the name is set (#11217)
4840
- // Support: Windows Web Apps (WWA)
4841
- // `name` and `type` must use .setAttribute for WWA (#14901)
4842
- input.setAttribute( "type", "radio" );
4843
- input.setAttribute( "checked", "checked" );
4844
- input.setAttribute( "name", "t" );
4845
-
4846
- div.appendChild( input );
4847
-
4848
- // Support: Android <=4.1 only
4849
- // Older WebKit doesn't clone checked state correctly in fragments
4850
- support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked;
4851
-
4852
- // Support: IE <=11 only
4853
- // Make sure textarea (and checkbox) defaultValue is properly cloned
4854
- div.innerHTML = "<textarea>x</textarea>";
4855
- support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue;
4856
- } )();
4857
- var documentElement = document.documentElement;
4858
-
4859
-
4860
-
4861
5092
  var
4862
5093
  rkeyEvent = /^key/,
4863
5094
  rmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/,
@@ -4871,8 +5102,19 @@ function returnFalse() {
4871
5102
  return false;
4872
5103
  }
4873
5104
 
5105
+ // Support: IE <=9 - 11+
5106
+ // focus() and blur() are asynchronous, except when they are no-op.
5107
+ // So expect focus to be synchronous when the element is already active,
5108
+ // and blur to be synchronous when the element is not already active.
5109
+ // (focus and blur are always synchronous in other supported browsers,
5110
+ // this just defines when we can count on it).
5111
+ function expectSync( elem, type ) {
5112
+ return ( elem === safeActiveElement() ) === ( type === "focus" );
5113
+ }
5114
+
4874
5115
  // Support: IE <=9 only
4875
- // See #13393 for more info
5116
+ // Accessing document.activeElement can throw unexpectedly
5117
+ // https://bugs.jquery.com/ticket/13393
4876
5118
  function safeActiveElement() {
4877
5119
  try {
4878
5120
  return document.activeElement;
@@ -4955,8 +5197,8 @@ jQuery.event = {
4955
5197
  special, handlers, type, namespaces, origType,
4956
5198
  elemData = dataPriv.get( elem );
4957
5199
 
4958
- // Don't attach events to noData or text/comment nodes (but allow plain objects)
4959
- if ( !elemData ) {
5200
+ // Only attach events to objects that accept data
5201
+ if ( !acceptData( elem ) ) {
4960
5202
  return;
4961
5203
  }
4962
5204
 
@@ -4980,7 +5222,7 @@ jQuery.event = {
4980
5222
 
4981
5223
  // Init the element's event structure and main handler, if this is the first
4982
5224
  if ( !( events = elemData.events ) ) {
4983
- events = elemData.events = {};
5225
+ events = elemData.events = Object.create( null );
4984
5226
  }
4985
5227
  if ( !( eventHandle = elemData.handle ) ) {
4986
5228
  eventHandle = elemData.handle = function( e ) {
@@ -5138,12 +5380,15 @@ jQuery.event = {
5138
5380
 
5139
5381
  dispatch: function( nativeEvent ) {
5140
5382
 
5141
- // Make a writable jQuery.Event from the native event object
5142
- var event = jQuery.event.fix( nativeEvent );
5143
-
5144
5383
  var i, j, ret, matched, handleObj, handlerQueue,
5145
5384
  args = new Array( arguments.length ),
5146
- 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 ] || [],
5147
5392
  special = jQuery.event.special[ event.type ] || {};
5148
5393
 
5149
5394
  // Use the fix-ed jQuery.Event rather than the (read-only) native event
@@ -5172,9 +5417,10 @@ jQuery.event = {
5172
5417
  while ( ( handleObj = matched.handlers[ j++ ] ) &&
5173
5418
  !event.isImmediatePropagationStopped() ) {
5174
5419
 
5175
- // Triggered event must either 1) have no namespace, or 2) have namespace(s)
5176
- // a subset or equal to those in the bound event (both can have no namespace).
5177
- if ( !event.rnamespace || event.rnamespace.test( handleObj.namespace ) ) {
5420
+ // If the event is namespaced, then each handler is only invoked if it is
5421
+ // specially universal or its namespaces are a superset of the event's.
5422
+ if ( !event.rnamespace || handleObj.namespace === false ||
5423
+ event.rnamespace.test( handleObj.namespace ) ) {
5178
5424
 
5179
5425
  event.handleObj = handleObj;
5180
5426
  event.data = handleObj.data;
@@ -5298,39 +5544,51 @@ jQuery.event = {
5298
5544
  // Prevent triggered image.load events from bubbling to window.load
5299
5545
  noBubble: true
5300
5546
  },
5301
- focus: {
5547
+ click: {
5302
5548
 
5303
- // Fire native event if possible so blur/focus sequence is correct
5304
- trigger: function() {
5305
- if ( this !== safeActiveElement() && this.focus ) {
5306
- this.focus();
5307
- return false;
5308
- }
5309
- },
5310
- delegateType: "focusin"
5311
- },
5312
- blur: {
5313
- trigger: function() {
5314
- if ( this === safeActiveElement() && this.blur ) {
5315
- this.blur();
5316
- return false;
5549
+ // Utilize native event to ensure correct state for checkable inputs
5550
+ setup: function( data ) {
5551
+
5552
+ // For mutual compressibility with _default, replace `this` access with a local var.
5553
+ // `|| data` is dead code meant only to preserve the variable through minification.
5554
+ var el = this || data;
5555
+
5556
+ // Claim the first handler
5557
+ if ( rcheckableType.test( el.type ) &&
5558
+ el.click && nodeName( el, "input" ) ) {
5559
+
5560
+ // dataPriv.set( el, "click", ... )
5561
+ leverageNative( el, "click", returnTrue );
5317
5562
  }
5563
+
5564
+ // Return false to allow normal processing in the caller
5565
+ return false;
5318
5566
  },
5319
- delegateType: "focusout"
5320
- },
5321
- click: {
5567
+ trigger: function( data ) {
5322
5568
 
5323
- // For checkbox, fire native event so checked state will be right
5324
- trigger: function() {
5325
- if ( this.type === "checkbox" && this.click && nodeName( this, "input" ) ) {
5326
- this.click();
5327
- return false;
5569
+ // For mutual compressibility with _default, replace `this` access with a local var.
5570
+ // `|| data` is dead code meant only to preserve the variable through minification.
5571
+ var el = this || data;
5572
+
5573
+ // Force setup before triggering a click
5574
+ if ( rcheckableType.test( el.type ) &&
5575
+ el.click && nodeName( el, "input" ) ) {
5576
+
5577
+ leverageNative( el, "click" );
5328
5578
  }
5579
+
5580
+ // Return non-false to allow normal event-path propagation
5581
+ return true;
5329
5582
  },
5330
5583
 
5331
- // For cross-browser consistency, don't fire native .click() on links
5584
+ // For cross-browser consistency, suppress native .click() on links
5585
+ // Also prevent it if we're currently inside a leveraged native-event stack
5332
5586
  _default: function( event ) {
5333
- return nodeName( event.target, "a" );
5587
+ var target = event.target;
5588
+ return rcheckableType.test( target.type ) &&
5589
+ target.click && nodeName( target, "input" ) &&
5590
+ dataPriv.get( target, "click" ) ||
5591
+ nodeName( target, "a" );
5334
5592
  }
5335
5593
  },
5336
5594
 
@@ -5347,6 +5605,93 @@ jQuery.event = {
5347
5605
  }
5348
5606
  };
5349
5607
 
5608
+ // Ensure the presence of an event listener that handles manually-triggered
5609
+ // synthetic events by interrupting progress until reinvoked in response to
5610
+ // *native* events that it fires directly, ensuring that state changes have
5611
+ // already occurred before other listeners are invoked.
5612
+ function leverageNative( el, type, expectSync ) {
5613
+
5614
+ // Missing expectSync indicates a trigger call, which must force setup through jQuery.event.add
5615
+ if ( !expectSync ) {
5616
+ if ( dataPriv.get( el, type ) === undefined ) {
5617
+ jQuery.event.add( el, type, returnTrue );
5618
+ }
5619
+ return;
5620
+ }
5621
+
5622
+ // Register the controller as a special universal handler for all event namespaces
5623
+ dataPriv.set( el, type, false );
5624
+ jQuery.event.add( el, type, {
5625
+ namespace: false,
5626
+ handler: function( event ) {
5627
+ var notAsync, result,
5628
+ saved = dataPriv.get( this, type );
5629
+
5630
+ if ( ( event.isTrigger & 1 ) && this[ type ] ) {
5631
+
5632
+ // Interrupt processing of the outer synthetic .trigger()ed event
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 ) {
5636
+
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.
5640
+ saved = slice.call( arguments );
5641
+ dataPriv.set( this, type, saved );
5642
+
5643
+ // Trigger the native event and capture its result
5644
+ // Support: IE <=9 - 11+
5645
+ // focus() and blur() are asynchronous
5646
+ notAsync = expectSync( this, type );
5647
+ this[ type ]();
5648
+ result = dataPriv.get( this, type );
5649
+ if ( saved !== result || notAsync ) {
5650
+ dataPriv.set( this, type, false );
5651
+ } else {
5652
+ result = {};
5653
+ }
5654
+ if ( saved !== result ) {
5655
+
5656
+ // Cancel the outer synthetic event
5657
+ event.stopImmediatePropagation();
5658
+ event.preventDefault();
5659
+ return result.value;
5660
+ }
5661
+
5662
+ // If this is an inner synthetic event for an event with a bubbling surrogate
5663
+ // (focus or blur), assume that the surrogate already propagated from triggering the
5664
+ // native event and prevent that from happening again here.
5665
+ // This technically gets the ordering wrong w.r.t. to `.trigger()` (in which the
5666
+ // bubbling surrogate propagates *after* the non-bubbling base), but that seems
5667
+ // less bad than duplication.
5668
+ } else if ( ( jQuery.event.special[ type ] || {} ).delegateType ) {
5669
+ event.stopPropagation();
5670
+ }
5671
+
5672
+ // If this is a native event triggered above, everything is now in order
5673
+ // Fire an inner synthetic event with the original arguments
5674
+ } else if ( saved.length ) {
5675
+
5676
+ // ...and capture the result
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
+ } );
5687
+
5688
+ // Abort handling of the native event
5689
+ event.stopImmediatePropagation();
5690
+ }
5691
+ }
5692
+ } );
5693
+ }
5694
+
5350
5695
  jQuery.removeEvent = function( elem, type, handle ) {
5351
5696
 
5352
5697
  // This "if" is needed for plain objects
@@ -5459,6 +5804,7 @@ jQuery.each( {
5459
5804
  shiftKey: true,
5460
5805
  view: true,
5461
5806
  "char": true,
5807
+ code: true,
5462
5808
  charCode: true,
5463
5809
  key: true,
5464
5810
  keyCode: true,
@@ -5505,6 +5851,33 @@ jQuery.each( {
5505
5851
  }
5506
5852
  }, jQuery.event.addProp );
5507
5853
 
5854
+ jQuery.each( { focus: "focusin", blur: "focusout" }, function( type, delegateType ) {
5855
+ jQuery.event.special[ type ] = {
5856
+
5857
+ // Utilize native event if possible so blur/focus sequence is correct
5858
+ setup: function() {
5859
+
5860
+ // Claim the first handler
5861
+ // dataPriv.set( this, "focus", ... )
5862
+ // dataPriv.set( this, "blur", ... )
5863
+ leverageNative( this, type, expectSync );
5864
+
5865
+ // Return false to allow normal processing in the caller
5866
+ return false;
5867
+ },
5868
+ trigger: function() {
5869
+
5870
+ // Force setup before trigger
5871
+ leverageNative( this, type );
5872
+
5873
+ // Return non-false to allow normal event-path propagation
5874
+ return true;
5875
+ },
5876
+
5877
+ delegateType: delegateType
5878
+ };
5879
+ } );
5880
+
5508
5881
  // Create mouseenter/leave events using mouseover/out and event-time checks
5509
5882
  // so that event delegation works in jQuery.
5510
5883
  // Do the same for pointerenter/pointerleave and pointerover/pointerout
@@ -5590,13 +5963,6 @@ jQuery.fn.extend( {
5590
5963
 
5591
5964
  var
5592
5965
 
5593
- /* eslint-disable max-len */
5594
-
5595
- // See https://github.com/eslint/eslint/issues/3229
5596
- rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi,
5597
-
5598
- /* eslint-enable */
5599
-
5600
5966
  // Support: IE <=10 - 11, Edge 12 - 13 only
5601
5967
  // In IE/Edge using regex groups here causes severe slowdowns.
5602
5968
  // See https://connect.microsoft.com/IE/feedback/details/1736512/
@@ -5633,7 +5999,7 @@ function restoreScript( elem ) {
5633
5999
  }
5634
6000
 
5635
6001
  function cloneCopyEvent( src, dest ) {
5636
- var i, l, type, pdataOld, pdataCur, udataOld, udataCur, events;
6002
+ var i, l, type, pdataOld, udataOld, udataCur, events;
5637
6003
 
5638
6004
  if ( dest.nodeType !== 1 ) {
5639
6005
  return;
@@ -5641,13 +6007,11 @@ function cloneCopyEvent( src, dest ) {
5641
6007
 
5642
6008
  // 1. Copy private data: events, handlers, etc.
5643
6009
  if ( dataPriv.hasData( src ) ) {
5644
- pdataOld = dataPriv.access( src );
5645
- pdataCur = dataPriv.set( dest, pdataOld );
6010
+ pdataOld = dataPriv.get( src );
5646
6011
  events = pdataOld.events;
5647
6012
 
5648
6013
  if ( events ) {
5649
- delete pdataCur.handle;
5650
- pdataCur.events = {};
6014
+ dataPriv.remove( dest, "handle events" );
5651
6015
 
5652
6016
  for ( type in events ) {
5653
6017
  for ( i = 0, l = events[ type ].length; i < l; i++ ) {
@@ -5683,7 +6047,7 @@ function fixInput( src, dest ) {
5683
6047
  function domManip( collection, args, callback, ignored ) {
5684
6048
 
5685
6049
  // Flatten any nested arrays
5686
- args = concat.apply( [], args );
6050
+ args = flat( args );
5687
6051
 
5688
6052
  var fragment, first, scripts, hasScripts, node, doc,
5689
6053
  i = 0,
@@ -5755,11 +6119,13 @@ function domManip( collection, args, callback, ignored ) {
5755
6119
  if ( node.src && ( node.type || "" ).toLowerCase() !== "module" ) {
5756
6120
 
5757
6121
  // Optional AJAX dependency, but won't run scripts if not present
5758
- if ( jQuery._evalUrl ) {
5759
- jQuery._evalUrl( node.src );
6122
+ if ( jQuery._evalUrl && !node.noModule ) {
6123
+ jQuery._evalUrl( node.src, {
6124
+ nonce: node.nonce || node.getAttribute( "nonce" )
6125
+ }, doc );
5760
6126
  }
5761
6127
  } else {
5762
- DOMEval( node.textContent.replace( rcleanScript, "" ), doc, node );
6128
+ DOMEval( node.textContent.replace( rcleanScript, "" ), node, doc );
5763
6129
  }
5764
6130
  }
5765
6131
  }
@@ -5781,7 +6147,7 @@ function remove( elem, selector, keepData ) {
5781
6147
  }
5782
6148
 
5783
6149
  if ( node.parentNode ) {
5784
- if ( keepData && jQuery.contains( node.ownerDocument, node ) ) {
6150
+ if ( keepData && isAttached( node ) ) {
5785
6151
  setGlobalEval( getAll( node, "script" ) );
5786
6152
  }
5787
6153
  node.parentNode.removeChild( node );
@@ -5793,13 +6159,13 @@ function remove( elem, selector, keepData ) {
5793
6159
 
5794
6160
  jQuery.extend( {
5795
6161
  htmlPrefilter: function( html ) {
5796
- return html.replace( rxhtmlTag, "<$1></$2>" );
6162
+ return html;
5797
6163
  },
5798
6164
 
5799
6165
  clone: function( elem, dataAndEvents, deepDataAndEvents ) {
5800
6166
  var i, l, srcElements, destElements,
5801
6167
  clone = elem.cloneNode( true ),
5802
- inPage = jQuery.contains( elem.ownerDocument, elem );
6168
+ inPage = isAttached( elem );
5803
6169
 
5804
6170
  // Fix IE cloning issues
5805
6171
  if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) &&
@@ -6055,6 +6421,27 @@ var getStyles = function( elem ) {
6055
6421
  return view.getComputedStyle( elem );
6056
6422
  };
6057
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
+
6058
6445
  var rboxStyle = new RegExp( cssExpand.join( "|" ), "i" );
6059
6446
 
6060
6447
 
@@ -6095,8 +6482,10 @@ var rboxStyle = new RegExp( cssExpand.join( "|" ), "i" );
6095
6482
 
6096
6483
  // Support: IE 9 only
6097
6484
  // Detect overflow:scroll screwiness (gh-3699)
6485
+ // Support: Chrome <=64
6486
+ // Don't get tricked when zoom affects offsetWidth (gh-4029)
6098
6487
  div.style.position = "absolute";
6099
- scrollboxSizeVal = div.offsetWidth === 36 || "absolute";
6488
+ scrollboxSizeVal = roundPixelMeasures( div.offsetWidth / 3 ) === 12;
6100
6489
 
6101
6490
  documentElement.removeChild( container );
6102
6491
 
@@ -6110,7 +6499,7 @@ var rboxStyle = new RegExp( cssExpand.join( "|" ), "i" );
6110
6499
  }
6111
6500
 
6112
6501
  var pixelPositionVal, boxSizingReliableVal, scrollboxSizeVal, pixelBoxStylesVal,
6113
- reliableMarginLeftVal,
6502
+ reliableTrDimensionsVal, reliableMarginLeftVal,
6114
6503
  container = document.createElement( "div" ),
6115
6504
  div = document.createElement( "div" );
6116
6505
 
@@ -6145,6 +6534,35 @@ var rboxStyle = new RegExp( cssExpand.join( "|" ), "i" );
6145
6534
  scrollboxSize: function() {
6146
6535
  computeStyleTests();
6147
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;
6148
6566
  }
6149
6567
  } );
6150
6568
  } )();
@@ -6167,7 +6585,7 @@ function curCSS( elem, name, computed ) {
6167
6585
  if ( computed ) {
6168
6586
  ret = computed.getPropertyValue( name ) || computed[ name ];
6169
6587
 
6170
- if ( ret === "" && !jQuery.contains( elem.ownerDocument, elem ) ) {
6588
+ if ( ret === "" && !isAttached( elem ) ) {
6171
6589
  ret = jQuery.style( elem, name );
6172
6590
  }
6173
6591
 
@@ -6223,30 +6641,13 @@ function addGetHookIf( conditionFn, hookFn ) {
6223
6641
  }
6224
6642
 
6225
6643
 
6226
- var
6227
-
6228
- // Swappable if display is none or starts with table
6229
- // except "table", "table-cell", or "table-caption"
6230
- // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
6231
- rdisplayswap = /^(none|table(?!-c[ea]).+)/,
6232
- rcustomProp = /^--/,
6233
- cssShow = { position: "absolute", visibility: "hidden", display: "block" },
6234
- cssNormalTransform = {
6235
- letterSpacing: "0",
6236
- fontWeight: "400"
6237
- },
6238
-
6239
- cssPrefixes = [ "Webkit", "Moz", "ms" ],
6240
- emptyStyle = document.createElement( "div" ).style;
6644
+ var cssPrefixes = [ "Webkit", "Moz", "ms" ],
6645
+ emptyStyle = document.createElement( "div" ).style,
6646
+ vendorProps = {};
6241
6647
 
6242
- // Return a css property mapped to a potentially vendor prefixed property
6648
+ // Return a vendor-prefixed property or undefined
6243
6649
  function vendorPropName( name ) {
6244
6650
 
6245
- // Shortcut for names that are not vendor prefixed
6246
- if ( name in emptyStyle ) {
6247
- return name;
6248
- }
6249
-
6250
6651
  // Check for vendor prefixed names
6251
6652
  var capName = name[ 0 ].toUpperCase() + name.slice( 1 ),
6252
6653
  i = cssPrefixes.length;
@@ -6259,17 +6660,34 @@ function vendorPropName( name ) {
6259
6660
  }
6260
6661
  }
6261
6662
 
6262
- // Return a property mapped along what jQuery.cssProps suggests or to
6263
- // a vendor prefixed property.
6663
+ // Return a potentially-mapped jQuery.cssProps or vendor prefixed property
6264
6664
  function finalPropName( name ) {
6265
- var ret = jQuery.cssProps[ name ];
6266
- if ( !ret ) {
6267
- ret = jQuery.cssProps[ name ] = vendorPropName( name ) || name;
6665
+ var final = jQuery.cssProps[ name ] || vendorProps[ name ];
6666
+
6667
+ if ( final ) {
6668
+ return final;
6268
6669
  }
6269
- return ret;
6670
+ if ( name in emptyStyle ) {
6671
+ return name;
6672
+ }
6673
+ return vendorProps[ name ] = vendorPropName( name ) || name;
6270
6674
  }
6271
6675
 
6272
- function setPositiveNumber( elem, value, subtract ) {
6676
+
6677
+ var
6678
+
6679
+ // Swappable if display is none or starts with table
6680
+ // except "table", "table-cell", or "table-caption"
6681
+ // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
6682
+ rdisplayswap = /^(none|table(?!-c[ea]).+)/,
6683
+ rcustomProp = /^--/,
6684
+ cssShow = { position: "absolute", visibility: "hidden", display: "block" },
6685
+ cssNormalTransform = {
6686
+ letterSpacing: "0",
6687
+ fontWeight: "400"
6688
+ };
6689
+
6690
+ function setPositiveNumber( _elem, value, subtract ) {
6273
6691
 
6274
6692
  // Any relative (+/-) values have already been
6275
6693
  // normalized at this point
@@ -6340,7 +6758,10 @@ function boxModelAdjustment( elem, dimension, box, isBorderBox, styles, computed
6340
6758
  delta -
6341
6759
  extra -
6342
6760
  0.5
6343
- ) );
6761
+
6762
+ // If offsetWidth/offsetHeight is unknown, then we can't determine content-box scroll gutter
6763
+ // Use an explicit zero to avoid NaN (gh-3964)
6764
+ ) ) || 0;
6344
6765
  }
6345
6766
 
6346
6767
  return delta;
@@ -6350,9 +6771,16 @@ function getWidthOrHeight( elem, dimension, extra ) {
6350
6771
 
6351
6772
  // Start with computed style
6352
6773
  var styles = getStyles( elem ),
6774
+
6775
+ // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-4322).
6776
+ // Fake content-box until we know it's needed to know the true value.
6777
+ boxSizingNeeded = !support.boxSizingReliable() || extra,
6778
+ isBorderBox = boxSizingNeeded &&
6779
+ jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
6780
+ valueIsBorderBox = isBorderBox,
6781
+
6353
6782
  val = curCSS( elem, dimension, styles ),
6354
- isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
6355
- valueIsBorderBox = isBorderBox;
6783
+ offsetProp = "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 );
6356
6784
 
6357
6785
  // Support: Firefox <=54
6358
6786
  // Return a confounding non-pixel value or feign ignorance, as appropriate.
@@ -6363,22 +6791,38 @@ function getWidthOrHeight( elem, dimension, extra ) {
6363
6791
  val = "auto";
6364
6792
  }
6365
6793
 
6366
- // Check for style in case a browser which returns unreliable values
6367
- // for getComputedStyle silently falls back to the reliable elem.style
6368
- valueIsBorderBox = valueIsBorderBox &&
6369
- ( support.boxSizingReliable() || val === elem.style[ dimension ] );
6370
6794
 
6371
- // Fall back to offsetWidth/offsetHeight when value is "auto"
6372
- // This happens for inline elements with no explicit setting (gh-3571)
6373
- // Support: Android <=4.1 - 4.3 only
6374
- // Also use offsetWidth/offsetHeight for misreported inline dimensions (gh-3602)
6375
- if ( val === "auto" ||
6376
- !parseFloat( val ) && jQuery.css( elem, "display", false, styles ) === "inline" ) {
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.
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)
6808
+ val === "auto" ||
6809
+
6810
+ // Support: Android <=4.1 - 4.3 only
6811
+ // Also use offsetWidth/offsetHeight for misreported inline dimensions (gh-3602)
6812
+ !parseFloat( val ) && jQuery.css( elem, "display", false, styles ) === "inline" ) &&
6377
6813
 
6378
- val = elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ];
6814
+ // Make sure the element is visible & connected
6815
+ elem.getClientRects().length ) {
6379
6816
 
6380
- // offsetWidth/offsetHeight provide border-box values
6381
- valueIsBorderBox = true;
6817
+ isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box";
6818
+
6819
+ // Where available, offsetWidth/offsetHeight approximate border box dimensions.
6820
+ // Where not available (e.g., SVG), assume unreliable box-sizing and interpret the
6821
+ // retrieved value as a content box dimension.
6822
+ valueIsBorderBox = offsetProp in elem;
6823
+ if ( valueIsBorderBox ) {
6824
+ val = elem[ offsetProp ];
6825
+ }
6382
6826
  }
6383
6827
 
6384
6828
  // Normalize "" and auto
@@ -6424,6 +6868,13 @@ jQuery.extend( {
6424
6868
  "flexGrow": true,
6425
6869
  "flexShrink": true,
6426
6870
  "fontWeight": true,
6871
+ "gridArea": true,
6872
+ "gridColumn": true,
6873
+ "gridColumnEnd": true,
6874
+ "gridColumnStart": true,
6875
+ "gridRow": true,
6876
+ "gridRowEnd": true,
6877
+ "gridRowStart": true,
6427
6878
  "lineHeight": true,
6428
6879
  "opacity": true,
6429
6880
  "order": true,
@@ -6479,7 +6930,9 @@ jQuery.extend( {
6479
6930
  }
6480
6931
 
6481
6932
  // If a number was passed in, add the unit (except for certain CSS properties)
6482
- if ( type === "number" ) {
6933
+ // The isCustomProp check can be removed in jQuery 4.0 when we only auto-append
6934
+ // "px" to a few hardcoded values.
6935
+ if ( type === "number" && !isCustomProp ) {
6483
6936
  value += ret && ret[ 3 ] || ( jQuery.cssNumber[ origName ] ? "" : "px" );
6484
6937
  }
6485
6938
 
@@ -6553,7 +7006,7 @@ jQuery.extend( {
6553
7006
  }
6554
7007
  } );
6555
7008
 
6556
- jQuery.each( [ "height", "width" ], function( i, dimension ) {
7009
+ jQuery.each( [ "height", "width" ], function( _i, dimension ) {
6557
7010
  jQuery.cssHooks[ dimension ] = {
6558
7011
  get: function( elem, computed, extra ) {
6559
7012
  if ( computed ) {
@@ -6579,18 +7032,29 @@ jQuery.each( [ "height", "width" ], function( i, dimension ) {
6579
7032
  set: function( elem, value, extra ) {
6580
7033
  var matches,
6581
7034
  styles = getStyles( elem ),
6582
- isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
6583
- subtract = extra && boxModelAdjustment(
6584
- elem,
6585
- dimension,
6586
- extra,
6587
- isBorderBox,
6588
- styles
6589
- );
7035
+
7036
+ // Only read styles.position if the test has a chance to fail
7037
+ // to avoid forcing a reflow.
7038
+ scrollboxSizeBuggy = !support.scrollboxSize() &&
7039
+ styles.position === "absolute",
7040
+
7041
+ // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-3991)
7042
+ boxSizingNeeded = scrollboxSizeBuggy || extra,
7043
+ isBorderBox = boxSizingNeeded &&
7044
+ jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
7045
+ subtract = extra ?
7046
+ boxModelAdjustment(
7047
+ elem,
7048
+ dimension,
7049
+ extra,
7050
+ isBorderBox,
7051
+ styles
7052
+ ) :
7053
+ 0;
6590
7054
 
6591
7055
  // Account for unreliable border-box dimensions by comparing offset* to computed and
6592
7056
  // faking a content-box to get border and padding (gh-3699)
6593
- if ( isBorderBox && support.scrollboxSize() === styles.position ) {
7057
+ if ( isBorderBox && scrollboxSizeBuggy ) {
6594
7058
  subtract -= Math.ceil(
6595
7059
  elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] -
6596
7060
  parseFloat( styles[ dimension ] ) -
@@ -6758,9 +7222,9 @@ Tween.propHooks = {
6758
7222
  // Use .style if available and use plain properties where available.
6759
7223
  if ( jQuery.fx.step[ tween.prop ] ) {
6760
7224
  jQuery.fx.step[ tween.prop ]( tween );
6761
- } else if ( tween.elem.nodeType === 1 &&
6762
- ( tween.elem.style[ jQuery.cssProps[ tween.prop ] ] != null ||
6763
- jQuery.cssHooks[ tween.prop ] ) ) {
7225
+ } else if ( tween.elem.nodeType === 1 && (
7226
+ jQuery.cssHooks[ tween.prop ] ||
7227
+ tween.elem.style[ finalPropName( tween.prop ) ] != null ) ) {
6764
7228
  jQuery.style( tween.elem, tween.prop, tween.now + tween.unit );
6765
7229
  } else {
6766
7230
  tween.elem[ tween.prop ] = tween.now;
@@ -7315,7 +7779,7 @@ jQuery.fn.extend( {
7315
7779
  clearQueue = type;
7316
7780
  type = undefined;
7317
7781
  }
7318
- if ( clearQueue && type !== false ) {
7782
+ if ( clearQueue ) {
7319
7783
  this.queue( type || "fx", [] );
7320
7784
  }
7321
7785
 
@@ -7398,7 +7862,7 @@ jQuery.fn.extend( {
7398
7862
  }
7399
7863
  } );
7400
7864
 
7401
- jQuery.each( [ "toggle", "show", "hide" ], function( i, name ) {
7865
+ jQuery.each( [ "toggle", "show", "hide" ], function( _i, name ) {
7402
7866
  var cssFn = jQuery.fn[ name ];
7403
7867
  jQuery.fn[ name ] = function( speed, easing, callback ) {
7404
7868
  return speed == null || typeof speed === "boolean" ?
@@ -7619,7 +8083,7 @@ boolHook = {
7619
8083
  }
7620
8084
  };
7621
8085
 
7622
- 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 ) {
7623
8087
  var getter = attrHandle[ name ] || jQuery.find.attr;
7624
8088
 
7625
8089
  attrHandle[ name ] = function( elem, name, isXML ) {
@@ -8243,7 +8707,9 @@ jQuery.extend( jQuery.event, {
8243
8707
  special.bindType || type;
8244
8708
 
8245
8709
  // jQuery handler
8246
- handle = ( dataPriv.get( cur, "events" ) || {} )[ event.type ] &&
8710
+ handle = (
8711
+ dataPriv.get( cur, "events" ) || Object.create( null )
8712
+ )[ event.type ] &&
8247
8713
  dataPriv.get( cur, "handle" );
8248
8714
  if ( handle ) {
8249
8715
  handle.apply( cur, data );
@@ -8354,7 +8820,10 @@ if ( !support.focusin ) {
8354
8820
 
8355
8821
  jQuery.event.special[ fix ] = {
8356
8822
  setup: function() {
8357
- 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,
8358
8827
  attaches = dataPriv.access( doc, fix );
8359
8828
 
8360
8829
  if ( !attaches ) {
@@ -8363,7 +8832,7 @@ if ( !support.focusin ) {
8363
8832
  dataPriv.access( doc, fix, ( attaches || 0 ) + 1 );
8364
8833
  },
8365
8834
  teardown: function() {
8366
- var doc = this.ownerDocument || this,
8835
+ var doc = this.ownerDocument || this.document || this,
8367
8836
  attaches = dataPriv.access( doc, fix ) - 1;
8368
8837
 
8369
8838
  if ( !attaches ) {
@@ -8379,7 +8848,7 @@ if ( !support.focusin ) {
8379
8848
  }
8380
8849
  var location = window.location;
8381
8850
 
8382
- var nonce = Date.now();
8851
+ var nonce = { guid: Date.now() };
8383
8852
 
8384
8853
  var rquery = ( /\?/ );
8385
8854
 
@@ -8467,6 +8936,10 @@ jQuery.param = function( a, traditional ) {
8467
8936
  encodeURIComponent( value == null ? "" : value );
8468
8937
  };
8469
8938
 
8939
+ if ( a == null ) {
8940
+ return "";
8941
+ }
8942
+
8470
8943
  // If an array was passed in, assume that it is an array of form elements.
8471
8944
  if ( Array.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
8472
8945
 
@@ -8507,7 +8980,7 @@ jQuery.fn.extend( {
8507
8980
  rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) &&
8508
8981
  ( this.checked || !rcheckableType.test( type ) );
8509
8982
  } )
8510
- .map( function( i, elem ) {
8983
+ .map( function( _i, elem ) {
8511
8984
  var val = jQuery( this ).val();
8512
8985
 
8513
8986
  if ( val == null ) {
@@ -8969,12 +9442,14 @@ jQuery.extend( {
8969
9442
  if ( !responseHeaders ) {
8970
9443
  responseHeaders = {};
8971
9444
  while ( ( match = rheaders.exec( responseHeadersString ) ) ) {
8972
- responseHeaders[ match[ 1 ].toLowerCase() ] = match[ 2 ];
9445
+ responseHeaders[ match[ 1 ].toLowerCase() + " " ] =
9446
+ ( responseHeaders[ match[ 1 ].toLowerCase() + " " ] || [] )
9447
+ .concat( match[ 2 ] );
8973
9448
  }
8974
9449
  }
8975
- match = responseHeaders[ key.toLowerCase() ];
9450
+ match = responseHeaders[ key.toLowerCase() + " " ];
8976
9451
  }
8977
- return match == null ? null : match;
9452
+ return match == null ? null : match.join( ", " );
8978
9453
  },
8979
9454
 
8980
9455
  // Raw string
@@ -9118,7 +9593,8 @@ jQuery.extend( {
9118
9593
  // Add or update anti-cache param if needed
9119
9594
  if ( s.cache === false ) {
9120
9595
  cacheURL = cacheURL.replace( rantiCache, "$1" );
9121
- uncached = ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ( nonce++ ) + uncached;
9596
+ uncached = ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ( nonce.guid++ ) +
9597
+ uncached;
9122
9598
  }
9123
9599
 
9124
9600
  // Put hash and anti-cache on the URL that will be requested (gh-1732)
@@ -9251,6 +9727,11 @@ jQuery.extend( {
9251
9727
  response = ajaxHandleResponses( s, jqXHR, responses );
9252
9728
  }
9253
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
+
9254
9735
  // Convert no matter what (that way responseXXX fields are always set)
9255
9736
  response = ajaxConvert( s, response, jqXHR, isSuccess );
9256
9737
 
@@ -9341,7 +9822,7 @@ jQuery.extend( {
9341
9822
  }
9342
9823
  } );
9343
9824
 
9344
- jQuery.each( [ "get", "post" ], function( i, method ) {
9825
+ jQuery.each( [ "get", "post" ], function( _i, method ) {
9345
9826
  jQuery[ method ] = function( url, data, callback, type ) {
9346
9827
 
9347
9828
  // Shift arguments if data argument was omitted
@@ -9362,8 +9843,17 @@ jQuery.each( [ "get", "post" ], function( i, method ) {
9362
9843
  };
9363
9844
  } );
9364
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
+
9365
9855
 
9366
- jQuery._evalUrl = function( url ) {
9856
+ jQuery._evalUrl = function( url, options, doc ) {
9367
9857
  return jQuery.ajax( {
9368
9858
  url: url,
9369
9859
 
@@ -9373,7 +9863,16 @@ jQuery._evalUrl = function( url ) {
9373
9863
  cache: true,
9374
9864
  async: false,
9375
9865
  global: false,
9376
- "throws": true
9866
+
9867
+ // Only evaluate the response if it is successful (gh-4126)
9868
+ // dataFilter is not invoked for failure responses, so using it instead
9869
+ // of the default converter is kludgy but it works.
9870
+ converters: {
9871
+ "text script": function() {}
9872
+ },
9873
+ dataFilter: function( response ) {
9874
+ jQuery.globalEval( response, options, doc );
9875
+ }
9377
9876
  } );
9378
9877
  };
9379
9878
 
@@ -9656,24 +10155,21 @@ jQuery.ajaxPrefilter( "script", function( s ) {
9656
10155
  // Bind script tag hack transport
9657
10156
  jQuery.ajaxTransport( "script", function( s ) {
9658
10157
 
9659
- // This transport only deals with cross domain requests
9660
- if ( s.crossDomain ) {
10158
+ // This transport only deals with cross domain or forced-by-attrs requests
10159
+ if ( s.crossDomain || s.scriptAttrs ) {
9661
10160
  var script, callback;
9662
10161
  return {
9663
10162
  send: function( _, complete ) {
9664
- script = jQuery( "<script>" ).prop( {
9665
- charset: s.scriptCharset,
9666
- src: s.url
9667
- } ).on(
9668
- "load error",
9669
- callback = function( evt ) {
10163
+ script = jQuery( "<script>" )
10164
+ .attr( s.scriptAttrs || {} )
10165
+ .prop( { charset: s.scriptCharset, src: s.url } )
10166
+ .on( "load error", callback = function( evt ) {
9670
10167
  script.remove();
9671
10168
  callback = null;
9672
10169
  if ( evt ) {
9673
10170
  complete( evt.type === "error" ? 404 : 200, evt.type );
9674
10171
  }
9675
- }
9676
- );
10172
+ } );
9677
10173
 
9678
10174
  // Use native DOM manipulation to avoid our domManip AJAX trickery
9679
10175
  document.head.appendChild( script[ 0 ] );
@@ -9697,7 +10193,7 @@ var oldCallbacks = [],
9697
10193
  jQuery.ajaxSetup( {
9698
10194
  jsonp: "callback",
9699
10195
  jsonpCallback: function() {
9700
- var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce++ ) );
10196
+ var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce.guid++ ) );
9701
10197
  this[ callback ] = true;
9702
10198
  return callback;
9703
10199
  }
@@ -9914,23 +10410,6 @@ jQuery.fn.load = function( url, params, callback ) {
9914
10410
 
9915
10411
 
9916
10412
 
9917
- // Attach a bunch of functions for handling common AJAX events
9918
- jQuery.each( [
9919
- "ajaxStart",
9920
- "ajaxStop",
9921
- "ajaxComplete",
9922
- "ajaxError",
9923
- "ajaxSuccess",
9924
- "ajaxSend"
9925
- ], function( i, type ) {
9926
- jQuery.fn[ type ] = function( fn ) {
9927
- return this.on( type, fn );
9928
- };
9929
- } );
9930
-
9931
-
9932
-
9933
-
9934
10413
  jQuery.expr.pseudos.animated = function( elem ) {
9935
10414
  return jQuery.grep( jQuery.timers, function( fn ) {
9936
10415
  return elem === fn.elem;
@@ -9987,6 +10466,12 @@ jQuery.offset = {
9987
10466
  options.using.call( elem, props );
9988
10467
 
9989
10468
  } else {
10469
+ if ( typeof props.top === "number" ) {
10470
+ props.top += "px";
10471
+ }
10472
+ if ( typeof props.left === "number" ) {
10473
+ props.left += "px";
10474
+ }
9990
10475
  curElem.css( props );
9991
10476
  }
9992
10477
  }
@@ -10137,7 +10622,7 @@ jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function(
10137
10622
  // Blink bug: https://bugs.chromium.org/p/chromium/issues/detail?id=589347
10138
10623
  // getComputedStyle returns percent when specified for top/left/bottom/right;
10139
10624
  // rather than make the css module depend on the offset module, just check for it here
10140
- jQuery.each( [ "top", "left" ], function( i, prop ) {
10625
+ jQuery.each( [ "top", "left" ], function( _i, prop ) {
10141
10626
  jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition,
10142
10627
  function( elem, computed ) {
10143
10628
  if ( computed ) {
@@ -10200,25 +10685,19 @@ jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
10200
10685
  } );
10201
10686
 
10202
10687
 
10203
- jQuery.each( ( "blur focus focusin focusout resize scroll click dblclick " +
10204
- "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
10205
- "change select submit keydown keypress keyup contextmenu" ).split( " " ),
10206
- function( i, name ) {
10207
-
10208
- // Handle event binding
10209
- jQuery.fn[ name ] = function( data, fn ) {
10210
- return arguments.length > 0 ?
10211
- this.on( name, null, data, fn ) :
10212
- 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 );
10213
10698
  };
10214
10699
  } );
10215
10700
 
10216
- jQuery.fn.extend( {
10217
- hover: function( fnOver, fnOut ) {
10218
- return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
10219
- }
10220
- } );
10221
-
10222
10701
 
10223
10702
 
10224
10703
 
@@ -10240,9 +10719,33 @@ jQuery.fn.extend( {
10240
10719
  return arguments.length === 1 ?
10241
10720
  this.off( selector, "**" ) :
10242
10721
  this.off( types, selector || "**", fn );
10722
+ },
10723
+
10724
+ hover: function( fnOver, fnOut ) {
10725
+ return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
10243
10726
  }
10244
10727
  } );
10245
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
+
10246
10749
  // Bind a function to a context, optionally partially applying any
10247
10750
  // arguments.
10248
10751
  // jQuery.proxy is deprecated to promote standards (specifically Function#bind)
@@ -10305,6 +10808,11 @@ jQuery.isNumeric = function( obj ) {
10305
10808
  !isNaN( obj - parseFloat( obj ) );
10306
10809
  };
10307
10810
 
10811
+ jQuery.trim = function( text ) {
10812
+ return text == null ?
10813
+ "" :
10814
+ ( text + "" ).replace( rtrim, "" );
10815
+ };
10308
10816
 
10309
10817
 
10310
10818
 
@@ -10353,7 +10861,7 @@ jQuery.noConflict = function( deep ) {
10353
10861
  // Expose jQuery and $ identifiers, even in AMD
10354
10862
  // (#7102#comment:10, https://github.com/jquery/jquery/pull/557)
10355
10863
  // and CommonJS for browser emulators (#13566)
10356
- if ( !noGlobal ) {
10864
+ if ( typeof noGlobal === "undefined" ) {
10357
10865
  window.jQuery = window.$ = jQuery;
10358
10866
  }
10359
10867