jquery-rails 4.3.1 → 4.3.2

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of jquery-rails might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 8c5d85690ee85928e2a30da55fa2b5aef44b96ed
4
- data.tar.gz: 9c89df4fbd6151582e4db8681690234da7528309
2
+ SHA256:
3
+ metadata.gz: 5a76cd41473ae892b41563cc5da92d80128f9ce67cf10299bf2156acd42d541c
4
+ data.tar.gz: 0b9ac7e9e60e2c5e9d359824b3fffb57d108377ab5343263070806f203ced7df
5
5
  SHA512:
6
- metadata.gz: 2309598856c6a21cfea1dde8f8261b992641f6c6711fe87b508af6ab82e44675c5e8c75d4f670282186e25637ab4a557248c3f08639bd183ae06a994aecffcd5
7
- data.tar.gz: b8e53ac98827eba878369fa1e3ed6f94c35be7fa91bf2f7a4812fbf6345d16474fec5689520a7cb8f5911b78be3818dd9bc2272a719174270ab41cef87b5e824
6
+ metadata.gz: 5723ae3be790ab76891234aa231989905f1b0024867300a8c1a7916dd6b27a9601a21b35def41e17b495805c09d0f719ee8d107b45d688924f3961784b967300
7
+ data.tar.gz: 8b87a9e027bd2428631abf2fecc525d811279acc6da6ceda413a692295ca7687779dddb491a5d493133904132e413cc159fedf6c75f404626d34416db4759b10
@@ -4,15 +4,18 @@ language: ruby
4
4
  rvm:
5
5
  - 1.9.3
6
6
  - 2.0.0
7
- - 2.1
8
- - 2.2.5
9
- - 2.3.0
7
+ - 2.1.10
8
+ - 2.2.9
9
+ - 2.3.6
10
+ - 2.4.3
11
+ - 2.5.0
10
12
  - jruby
11
13
  - ruby-head
12
14
  matrix:
13
15
  fast_finish: true
14
16
  allow_failures:
15
17
  - rvm: jruby
18
+ - rvm: ruby-head
16
19
  notifications:
17
20
  email: false
18
21
  irc:
@@ -1,3 +1,10 @@
1
+ ## 4.3.2
2
+
3
+ - update jquery to 3.3.0
4
+ - Add possibility to test HTML: all, attribute prefix, attribute contains,
5
+ attribute ends with, child, and class selectors
6
+ - Fix matching mutiple calls for the same selector/function exception
7
+
1
8
  ## 4.3.1
2
9
 
3
10
  - update jquery to 3.2.1
data/README.md CHANGED
@@ -31,6 +31,12 @@ The jquery and jquery-ujs files will be added to the asset pipeline and availabl
31
31
  //= require jquery_ujs
32
32
  ```
33
33
 
34
+ If you are running Rails 5.1 and up, and if you have included `//= require rails-ujs`, then `jquery_ujs` is not needed anymore. You can just add:
35
+
36
+ ```js
37
+ //= require jquery
38
+ ```
39
+
34
40
  If you want to use jQuery 2, you can require `jquery2` instead:
35
41
 
36
42
  ```js
@@ -2,6 +2,7 @@
2
2
 
3
3
  | Gem | jQuery | jQuery UJS | jQuery UI |
4
4
  |--------|--------|------------| ----------|
5
+ | 4.3.2 | 1.12.4 & 2.2.4 & 3.3.0 | 1.2.2 | - |
5
6
  | 4.3.1 | 1.12.4 & 2.2.4 & 3.2.1 | 1.2.2 | - |
6
7
  | 4.3.0 | 1.12.4 & 2.2.4 & 3.2.0 | 1.2.2 | - |
7
8
  | 4.2.2 | 1.12.4 & 2.2.4 & 3.1.1 | 1.2.2 | - |
@@ -47,7 +47,7 @@ module Rails::Dom::Testing::Assertions::SelectorAssertions
47
47
  # assert_select '.product'
48
48
  # end
49
49
 
50
- PATTERN_HTML = "['\"]((\\\\\"|[^\"])*)['\"]"
50
+ PATTERN_HTML = "['\"]((\\\\\"|\\\\'|[^\"'])*)['\"]"
51
51
  PATTERN_UNICODE_ESCAPED_CHAR = /\\u([0-9a-zA-Z]{4})/
52
52
  SKELETAL_PATTERN = "(?:jQuery|\\$)\\(%s\\)\\.%s\\(%s\\);"
53
53
 
@@ -91,14 +91,14 @@ module Rails::Dom::Testing::Assertions::SelectorAssertions
91
91
 
92
92
  if block_given?
93
93
  @selected ||= nil
94
- fragments = Nokogiri::HTML::Document.new
94
+ fragments = Nokogiri::HTML::Document.new.fragment
95
95
 
96
96
  if matched_pattern
97
97
  response.body.scan(Regexp.new(matched_pattern)).each do |match|
98
98
  flunk 'This function can\'t have HTML argument' if match.is_a?(String)
99
99
 
100
- doc = Nokogiri::HTML::Document.parse(unescape_js(match.first))
101
- doc.root.children.each do |child|
100
+ doc = Nokogiri::HTML::DocumentFragment.parse(unescape_js(match.first))
101
+ doc.children.each do |child|
102
102
  fragments << child if child.element?
103
103
  end
104
104
  end
@@ -134,6 +134,15 @@ module Rails::Dom::Testing::Assertions::SelectorAssertions
134
134
 
135
135
  id = selector.gsub('[', '\[')
136
136
  id.gsub!(']', '\]')
137
+ id.gsub!('*', '\*')
138
+ id.gsub!('(', '\(')
139
+ id.gsub!(')', '\)')
140
+ id.gsub!('.', '\.')
141
+ id.gsub!('|', '\|')
142
+ id.gsub!('^', '\^')
143
+ id.gsub!('$', '\$')
144
+ id.gsub!('+', "\\\\+")
145
+ id.gsub!(',', '\,')
137
146
 
138
147
  id
139
148
  end
@@ -1,9 +1,9 @@
1
1
  module Jquery
2
2
  module Rails
3
- VERSION = "4.3.1"
3
+ VERSION = "4.3.2"
4
4
  JQUERY_VERSION = "1.12.4"
5
5
  JQUERY_2_VERSION = "2.2.4"
6
- JQUERY_3_VERSION = "3.2.1"
6
+ JQUERY_3_VERSION = "3.3.0"
7
7
  JQUERY_UJS_VERSION = "1.2.2"
8
8
  end
9
9
  end
@@ -8,12 +8,17 @@ class AssertSelectJQueryTest < ActiveSupport::TestCase
8
8
  JAVASCRIPT_TEST_OUTPUT = <<-JS
9
9
  $("#card").show("blind", 1000);
10
10
  $("#id").html('<div><p>something</p></div>');
11
+ $('#card').html('<div><p>something else</p></div>');
11
12
  jQuery("#id").replaceWith("<div><p>something</p></div>");
12
13
  $("<div><p>something</p></div>").appendTo("#id");
14
+ $("<div><p>something else</p></div>").appendTo("#id");
13
15
  jQuery("<div><p>something</p></div>").prependTo("#id");
14
16
  $('#id').remove();
15
17
  jQuery("#id").hide();
16
18
  $("[data-placeholder~=name]").remove();
19
+ $("#cart tr:not(.total_line) > *").remove();
20
+ $("[href|=\"val\"][href$=\"val\"][href^=\"val\"]").remove();
21
+ $("tr + td, li").remove();
17
22
  JS
18
23
 
19
24
  setup do
@@ -30,17 +35,27 @@ class AssertSelectJQueryTest < ActiveSupport::TestCase
30
35
  assert_select 'p', 'something'
31
36
  end
32
37
  assert_select_jquery :remove, "[data-placeholder~=name]"
38
+ assert_select_jquery :remove, "#cart tr:not(.total_line) > *"
39
+ assert_select_jquery :remove, "[href|=\"val\"][href$=\"val\"][href^=\"val\"]"
40
+ assert_select_jquery :remove, "tr + td, li"
33
41
  end
34
42
 
35
43
  assert_raise Minitest::Assertion, "No JQuery call matches [:show, :some_wrong]" do
36
44
  assert_select_jquery :show, :some_wrong
37
45
  end
46
+
47
+ assert_raise Minitest::Assertion, "<something else> was expected but was <something>" do
48
+ assert_select_jquery :html, '#id' do
49
+ assert_select 'p', 'something else'
50
+ end
51
+ end
38
52
  end
39
53
 
40
54
  def test_target_as_argument
41
55
  assert_nothing_raised do
42
56
  assert_select_jquery :appendTo, '#id' do
43
57
  assert_select 'p', 'something'
58
+ assert_select 'p', 'something else'
44
59
  end
45
60
  assert_select_jquery :prependTo, '#id' do
46
61
  assert_select 'p', 'something'
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * jQuery JavaScript Library v3.2.1
2
+ * jQuery JavaScript Library v3.3.0
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: 2017-03-20T18:59Z
12
+ * Date: 2018-01-19T19:00Z
13
13
  */
14
14
  ( function( global, factory ) {
15
15
 
@@ -71,16 +71,57 @@ var ObjectFunctionString = fnToString.call( Object );
71
71
 
72
72
  var support = {};
73
73
 
74
+ var isFunction = function isFunction( obj ) {
74
75
 
76
+ // Support: Chrome <=57, Firefox <=52
77
+ // In some browsers, typeof returns "function" for HTML <object> elements
78
+ // (i.e., `typeof document.createElement( "object" ) === "function"`).
79
+ // We don't want to classify *any* DOM node as a function.
80
+ return typeof obj === "function" && typeof obj.nodeType !== "number";
81
+ };
75
82
 
76
- function DOMEval( code, doc ) {
83
+
84
+ var isWindow = function isWindow( obj ) {
85
+ return obj != null && obj === obj.window;
86
+ };
87
+
88
+
89
+
90
+
91
+ var preservedScriptAttributes = {
92
+ type: true,
93
+ src: true,
94
+ noModule: true
95
+ };
96
+
97
+ function DOMEval( code, doc, node ) {
77
98
  doc = doc || document;
78
99
 
79
- var script = doc.createElement( "script" );
100
+ var i,
101
+ script = doc.createElement( "script" );
80
102
 
81
103
  script.text = code;
104
+ if ( node ) {
105
+ for ( i in preservedScriptAttributes ) {
106
+ if ( node[ i ] ) {
107
+ script[ i ] = node[ i ];
108
+ }
109
+ }
110
+ }
82
111
  doc.head.appendChild( script ).parentNode.removeChild( script );
83
112
  }
113
+
114
+
115
+ function toType( obj ) {
116
+ if ( obj == null ) {
117
+ return obj + "";
118
+ }
119
+
120
+ // Support: Android <=2.3 only (functionish RegExp)
121
+ return typeof obj === "object" || typeof obj === "function" ?
122
+ class2type[ toString.call( obj ) ] || "object" :
123
+ typeof obj;
124
+ }
84
125
  /* global Symbol */
85
126
  // Defining this global in .eslintrc.json would create a danger of using the global
86
127
  // unguarded in another place, it seems safer to define global only for this module
@@ -88,7 +129,7 @@ var support = {};
88
129
 
89
130
 
90
131
  var
91
- version = "3.2.1",
132
+ version = "3.3.0",
92
133
 
93
134
  // Define a local copy of jQuery
94
135
  jQuery = function( selector, context ) {
@@ -100,16 +141,7 @@ var
100
141
 
101
142
  // Support: Android <=4.0 only
102
143
  // Make sure we trim BOM and NBSP
103
- rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,
104
-
105
- // Matches dashed string for camelizing
106
- rmsPrefix = /^-ms-/,
107
- rdashAlpha = /-([a-z])/g,
108
-
109
- // Used by jQuery.camelCase as callback to replace()
110
- fcamelCase = function( all, letter ) {
111
- return letter.toUpperCase();
112
- };
144
+ rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;
113
145
 
114
146
  jQuery.fn = jQuery.prototype = {
115
147
 
@@ -209,7 +241,7 @@ jQuery.extend = jQuery.fn.extend = function() {
209
241
  }
210
242
 
211
243
  // Handle case when target is a string or something (possible in deep copy)
212
- if ( typeof target !== "object" && !jQuery.isFunction( target ) ) {
244
+ if ( typeof target !== "object" && !isFunction( target ) ) {
213
245
  target = {};
214
246
  }
215
247
 
@@ -275,28 +307,6 @@ jQuery.extend( {
275
307
 
276
308
  noop: function() {},
277
309
 
278
- isFunction: function( obj ) {
279
- return jQuery.type( obj ) === "function";
280
- },
281
-
282
- isWindow: function( obj ) {
283
- return obj != null && obj === obj.window;
284
- },
285
-
286
- isNumeric: function( obj ) {
287
-
288
- // As of jQuery 3.0, isNumeric is limited to
289
- // strings and numbers (primitives or objects)
290
- // that can be coerced to finite numbers (gh-2662)
291
- var type = jQuery.type( obj );
292
- return ( type === "number" || type === "string" ) &&
293
-
294
- // parseFloat NaNs numeric-cast false positives ("")
295
- // ...but misinterprets leading-number strings, particularly hex literals ("0x...")
296
- // subtraction forces infinities to NaN
297
- !isNaN( obj - parseFloat( obj ) );
298
- },
299
-
300
310
  isPlainObject: function( obj ) {
301
311
  var proto, Ctor;
302
312
 
@@ -330,29 +340,11 @@ jQuery.extend( {
330
340
  return true;
331
341
  },
332
342
 
333
- type: function( obj ) {
334
- if ( obj == null ) {
335
- return obj + "";
336
- }
337
-
338
- // Support: Android <=2.3 only (functionish RegExp)
339
- return typeof obj === "object" || typeof obj === "function" ?
340
- class2type[ toString.call( obj ) ] || "object" :
341
- typeof obj;
342
- },
343
-
344
343
  // Evaluates a script in a global context
345
344
  globalEval: function( code ) {
346
345
  DOMEval( code );
347
346
  },
348
347
 
349
- // Convert dashed to camelCase; used by the css and data modules
350
- // Support: IE <=9 - 11, Edge 12 - 13
351
- // Microsoft forgot to hump their vendor prefix (#9572)
352
- camelCase: function( string ) {
353
- return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
354
- },
355
-
356
348
  each: function( obj, callback ) {
357
349
  var length, i = 0;
358
350
 
@@ -473,37 +465,6 @@ jQuery.extend( {
473
465
  // A global GUID counter for objects
474
466
  guid: 1,
475
467
 
476
- // Bind a function to a context, optionally partially applying any
477
- // arguments.
478
- proxy: function( fn, context ) {
479
- var tmp, args, proxy;
480
-
481
- if ( typeof context === "string" ) {
482
- tmp = fn[ context ];
483
- context = fn;
484
- fn = tmp;
485
- }
486
-
487
- // Quick check to determine if target is callable, in the spec
488
- // this throws a TypeError, but we will just return undefined.
489
- if ( !jQuery.isFunction( fn ) ) {
490
- return undefined;
491
- }
492
-
493
- // Simulated bind
494
- args = slice.call( arguments, 2 );
495
- proxy = function() {
496
- return fn.apply( context || this, args.concat( slice.call( arguments ) ) );
497
- };
498
-
499
- // Set the guid of unique handler to the same of original handler, so it can be removed
500
- proxy.guid = fn.guid = fn.guid || jQuery.guid++;
501
-
502
- return proxy;
503
- },
504
-
505
- now: Date.now,
506
-
507
468
  // jQuery.support is not used in Core but other projects attach their
508
469
  // properties to it so it needs to exist.
509
470
  support: support
@@ -526,9 +487,9 @@ function isArrayLike( obj ) {
526
487
  // hasOwn isn't used here due to false negatives
527
488
  // regarding Nodelist length in IE
528
489
  var length = !!obj && "length" in obj && obj.length,
529
- type = jQuery.type( obj );
490
+ type = toType( obj );
530
491
 
531
- if ( type === "function" || jQuery.isWindow( obj ) ) {
492
+ if ( isFunction( obj ) || isWindow( obj ) ) {
532
493
  return false;
533
494
  }
534
495
 
@@ -2848,11 +2809,9 @@ var rsingleTag = ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|
2848
2809
 
2849
2810
 
2850
2811
 
2851
- var risSimple = /^.[^:#\[\.,]*$/;
2852
-
2853
2812
  // Implement the identical functionality for filter and not
2854
2813
  function winnow( elements, qualifier, not ) {
2855
- if ( jQuery.isFunction( qualifier ) ) {
2814
+ if ( isFunction( qualifier ) ) {
2856
2815
  return jQuery.grep( elements, function( elem, i ) {
2857
2816
  return !!qualifier.call( elem, i, elem ) !== not;
2858
2817
  } );
@@ -2872,16 +2831,8 @@ function winnow( elements, qualifier, not ) {
2872
2831
  } );
2873
2832
  }
2874
2833
 
2875
- // Simple selector that can be filtered directly, removing non-Elements
2876
- if ( risSimple.test( qualifier ) ) {
2877
- return jQuery.filter( qualifier, elements, not );
2878
- }
2879
-
2880
- // Complex selector, compare the two sets, removing non-Elements
2881
- qualifier = jQuery.filter( qualifier, elements );
2882
- return jQuery.grep( elements, function( elem ) {
2883
- return ( indexOf.call( qualifier, elem ) > -1 ) !== not && elem.nodeType === 1;
2884
- } );
2834
+ // Filtered directly for both simple and complex selectors
2835
+ return jQuery.filter( qualifier, elements, not );
2885
2836
  }
2886
2837
 
2887
2838
  jQuery.filter = function( expr, elems, not ) {
@@ -3002,7 +2953,7 @@ var rootjQuery,
3002
2953
  for ( match in context ) {
3003
2954
 
3004
2955
  // Properties of context are called as methods if possible
3005
- if ( jQuery.isFunction( this[ match ] ) ) {
2956
+ if ( isFunction( this[ match ] ) ) {
3006
2957
  this[ match ]( context[ match ] );
3007
2958
 
3008
2959
  // ...and otherwise set as attributes
@@ -3045,7 +2996,7 @@ var rootjQuery,
3045
2996
 
3046
2997
  // HANDLE: $(function)
3047
2998
  // Shortcut for document ready
3048
- } else if ( jQuery.isFunction( selector ) ) {
2999
+ } else if ( isFunction( selector ) ) {
3049
3000
  return root.ready !== undefined ?
3050
3001
  root.ready( selector ) :
3051
3002
 
@@ -3360,11 +3311,11 @@ jQuery.Callbacks = function( options ) {
3360
3311
 
3361
3312
  ( function add( args ) {
3362
3313
  jQuery.each( args, function( _, arg ) {
3363
- if ( jQuery.isFunction( arg ) ) {
3314
+ if ( isFunction( arg ) ) {
3364
3315
  if ( !options.unique || !self.has( arg ) ) {
3365
3316
  list.push( arg );
3366
3317
  }
3367
- } else if ( arg && arg.length && jQuery.type( arg ) !== "string" ) {
3318
+ } else if ( arg && arg.length && toType( arg ) !== "string" ) {
3368
3319
 
3369
3320
  // Inspect recursively
3370
3321
  add( arg );
@@ -3479,11 +3430,11 @@ function adoptValue( value, resolve, reject, noValue ) {
3479
3430
  try {
3480
3431
 
3481
3432
  // Check for promise aspect first to privilege synchronous behavior
3482
- if ( value && jQuery.isFunction( ( method = value.promise ) ) ) {
3433
+ if ( value && isFunction( ( method = value.promise ) ) ) {
3483
3434
  method.call( value ).done( resolve ).fail( reject );
3484
3435
 
3485
3436
  // Other thenables
3486
- } else if ( value && jQuery.isFunction( ( method = value.then ) ) ) {
3437
+ } else if ( value && isFunction( ( method = value.then ) ) ) {
3487
3438
  method.call( value, resolve, reject );
3488
3439
 
3489
3440
  // Other non-thenables
@@ -3541,14 +3492,14 @@ jQuery.extend( {
3541
3492
  jQuery.each( tuples, function( i, tuple ) {
3542
3493
 
3543
3494
  // Map tuples (progress, done, fail) to arguments (done, fail, progress)
3544
- var fn = jQuery.isFunction( fns[ tuple[ 4 ] ] ) && fns[ tuple[ 4 ] ];
3495
+ var fn = isFunction( fns[ tuple[ 4 ] ] ) && fns[ tuple[ 4 ] ];
3545
3496
 
3546
3497
  // deferred.progress(function() { bind to newDefer or newDefer.notify })
3547
3498
  // deferred.done(function() { bind to newDefer or newDefer.resolve })
3548
3499
  // deferred.fail(function() { bind to newDefer or newDefer.reject })
3549
3500
  deferred[ tuple[ 1 ] ]( function() {
3550
3501
  var returned = fn && fn.apply( this, arguments );
3551
- if ( returned && jQuery.isFunction( returned.promise ) ) {
3502
+ if ( returned && isFunction( returned.promise ) ) {
3552
3503
  returned.promise()
3553
3504
  .progress( newDefer.notify )
3554
3505
  .done( newDefer.resolve )
@@ -3602,7 +3553,7 @@ jQuery.extend( {
3602
3553
  returned.then;
3603
3554
 
3604
3555
  // Handle a returned thenable
3605
- if ( jQuery.isFunction( then ) ) {
3556
+ if ( isFunction( then ) ) {
3606
3557
 
3607
3558
  // Special processors (notify) just wait for resolution
3608
3559
  if ( special ) {
@@ -3698,7 +3649,7 @@ jQuery.extend( {
3698
3649
  resolve(
3699
3650
  0,
3700
3651
  newDefer,
3701
- jQuery.isFunction( onProgress ) ?
3652
+ isFunction( onProgress ) ?
3702
3653
  onProgress :
3703
3654
  Identity,
3704
3655
  newDefer.notifyWith
@@ -3710,7 +3661,7 @@ jQuery.extend( {
3710
3661
  resolve(
3711
3662
  0,
3712
3663
  newDefer,
3713
- jQuery.isFunction( onFulfilled ) ?
3664
+ isFunction( onFulfilled ) ?
3714
3665
  onFulfilled :
3715
3666
  Identity
3716
3667
  )
@@ -3721,7 +3672,7 @@ jQuery.extend( {
3721
3672
  resolve(
3722
3673
  0,
3723
3674
  newDefer,
3724
- jQuery.isFunction( onRejected ) ?
3675
+ isFunction( onRejected ) ?
3725
3676
  onRejected :
3726
3677
  Thrower
3727
3678
  )
@@ -3761,8 +3712,15 @@ jQuery.extend( {
3761
3712
  // fulfilled_callbacks.disable
3762
3713
  tuples[ 3 - i ][ 2 ].disable,
3763
3714
 
3715
+ // rejected_handlers.disable
3716
+ // fulfilled_handlers.disable
3717
+ tuples[ 3 - i ][ 3 ].disable,
3718
+
3764
3719
  // progress_callbacks.lock
3765
- tuples[ 0 ][ 2 ].lock
3720
+ tuples[ 0 ][ 2 ].lock,
3721
+
3722
+ // progress_handlers.lock
3723
+ tuples[ 0 ][ 3 ].lock
3766
3724
  );
3767
3725
  }
3768
3726
 
@@ -3832,7 +3790,7 @@ jQuery.extend( {
3832
3790
 
3833
3791
  // Use .then() to unwrap secondary thenables (cf. gh-3000)
3834
3792
  if ( master.state() === "pending" ||
3835
- jQuery.isFunction( resolveValues[ i ] && resolveValues[ i ].then ) ) {
3793
+ isFunction( resolveValues[ i ] && resolveValues[ i ].then ) ) {
3836
3794
 
3837
3795
  return master.then();
3838
3796
  }
@@ -3960,7 +3918,7 @@ var access = function( elems, fn, key, value, chainable, emptyGet, raw ) {
3960
3918
  bulk = key == null;
3961
3919
 
3962
3920
  // Sets many values
3963
- if ( jQuery.type( key ) === "object" ) {
3921
+ if ( toType( key ) === "object" ) {
3964
3922
  chainable = true;
3965
3923
  for ( i in key ) {
3966
3924
  access( elems, fn, i, key[ i ], true, emptyGet, raw );
@@ -3970,7 +3928,7 @@ var access = function( elems, fn, key, value, chainable, emptyGet, raw ) {
3970
3928
  } else if ( value !== undefined ) {
3971
3929
  chainable = true;
3972
3930
 
3973
- if ( !jQuery.isFunction( value ) ) {
3931
+ if ( !isFunction( value ) ) {
3974
3932
  raw = true;
3975
3933
  }
3976
3934
 
@@ -4012,6 +3970,23 @@ var access = function( elems, fn, key, value, chainable, emptyGet, raw ) {
4012
3970
 
4013
3971
  return len ? fn( elems[ 0 ], key ) : emptyGet;
4014
3972
  };
3973
+
3974
+
3975
+ // Matches dashed string for camelizing
3976
+ var rmsPrefix = /^-ms-/,
3977
+ rdashAlpha = /-([a-z])/g;
3978
+
3979
+ // Used by camelCase as callback to replace()
3980
+ function fcamelCase( all, letter ) {
3981
+ return letter.toUpperCase();
3982
+ }
3983
+
3984
+ // Convert dashed to camelCase; used by the css and data modules
3985
+ // Support: IE <=9 - 11, Edge 12 - 15
3986
+ // Microsoft forgot to hump their vendor prefix (#9572)
3987
+ function camelCase( string ) {
3988
+ return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
3989
+ }
4015
3990
  var acceptData = function( owner ) {
4016
3991
 
4017
3992
  // Accepts only:
@@ -4074,14 +4049,14 @@ Data.prototype = {
4074
4049
  // Handle: [ owner, key, value ] args
4075
4050
  // Always use camelCase key (gh-2257)
4076
4051
  if ( typeof data === "string" ) {
4077
- cache[ jQuery.camelCase( data ) ] = value;
4052
+ cache[ camelCase( data ) ] = value;
4078
4053
 
4079
4054
  // Handle: [ owner, { properties } ] args
4080
4055
  } else {
4081
4056
 
4082
4057
  // Copy the properties one-by-one to the cache object
4083
4058
  for ( prop in data ) {
4084
- cache[ jQuery.camelCase( prop ) ] = data[ prop ];
4059
+ cache[ camelCase( prop ) ] = data[ prop ];
4085
4060
  }
4086
4061
  }
4087
4062
  return cache;
@@ -4091,7 +4066,7 @@ Data.prototype = {
4091
4066
  this.cache( owner ) :
4092
4067
 
4093
4068
  // Always use camelCase key (gh-2257)
4094
- owner[ this.expando ] && owner[ this.expando ][ jQuery.camelCase( key ) ];
4069
+ owner[ this.expando ] && owner[ this.expando ][ camelCase( key ) ];
4095
4070
  },
4096
4071
  access: function( owner, key, value ) {
4097
4072
 
@@ -4139,9 +4114,9 @@ Data.prototype = {
4139
4114
 
4140
4115
  // If key is an array of keys...
4141
4116
  // We always set camelCase keys, so remove that.
4142
- key = key.map( jQuery.camelCase );
4117
+ key = key.map( camelCase );
4143
4118
  } else {
4144
- key = jQuery.camelCase( key );
4119
+ key = camelCase( key );
4145
4120
 
4146
4121
  // If a key with the spaces exists, use it.
4147
4122
  // Otherwise, create an array by matching non-whitespace
@@ -4287,7 +4262,7 @@ jQuery.fn.extend( {
4287
4262
  if ( attrs[ i ] ) {
4288
4263
  name = attrs[ i ].name;
4289
4264
  if ( name.indexOf( "data-" ) === 0 ) {
4290
- name = jQuery.camelCase( name.slice( 5 ) );
4265
+ name = camelCase( name.slice( 5 ) );
4291
4266
  dataAttr( elem, name, data[ name ] );
4292
4267
  }
4293
4268
  }
@@ -4534,8 +4509,7 @@ var swap = function( elem, options, callback, args ) {
4534
4509
 
4535
4510
 
4536
4511
  function adjustCSS( elem, prop, valueParts, tween ) {
4537
- var adjusted,
4538
- scale = 1,
4512
+ var adjusted, scale,
4539
4513
  maxIterations = 20,
4540
4514
  currentValue = tween ?
4541
4515
  function() {
@@ -4553,30 +4527,33 @@ function adjustCSS( elem, prop, valueParts, tween ) {
4553
4527
 
4554
4528
  if ( initialInUnit && initialInUnit[ 3 ] !== unit ) {
4555
4529
 
4530
+ // Support: Firefox <=54
4531
+ // Halve the iteration target value to prevent interference from CSS upper bounds (gh-2144)
4532
+ initial = initial / 2;
4533
+
4556
4534
  // Trust units reported by jQuery.css
4557
4535
  unit = unit || initialInUnit[ 3 ];
4558
4536
 
4559
- // Make sure we update the tween properties later on
4560
- valueParts = valueParts || [];
4561
-
4562
4537
  // Iteratively approximate from a nonzero starting point
4563
4538
  initialInUnit = +initial || 1;
4564
4539
 
4565
- do {
4540
+ while ( maxIterations-- ) {
4566
4541
 
4567
- // If previous iteration zeroed out, double until we get *something*.
4568
- // Use string for doubling so we don't accidentally see scale as unchanged below
4569
- scale = scale || ".5";
4570
-
4571
- // Adjust and apply
4572
- initialInUnit = initialInUnit / scale;
4542
+ // Evaluate and update our best guess (doubling guesses that zero out).
4543
+ // Finish if the scale equals or crosses 1 (making the old*new product non-positive).
4573
4544
  jQuery.style( elem, prop, initialInUnit + unit );
4545
+ if ( ( 1 - scale ) * ( 1 - ( scale = currentValue() / initial || 0.5 ) ) <= 0 ) {
4546
+ maxIterations = 0;
4547
+ }
4548
+ initialInUnit = initialInUnit / scale;
4574
4549
 
4575
- // Update scale, tolerating zero or NaN from tween.cur()
4576
- // Break the loop if scale is unchanged or perfect, or if we've just had enough.
4577
- } while (
4578
- scale !== ( scale = currentValue() / initial ) && scale !== 1 && --maxIterations
4579
- );
4550
+ }
4551
+
4552
+ initialInUnit = initialInUnit * 2;
4553
+ jQuery.style( elem, prop, initialInUnit + unit );
4554
+
4555
+ // Make sure we update the tween properties later on
4556
+ valueParts = valueParts || [];
4580
4557
  }
4581
4558
 
4582
4559
  if ( valueParts ) {
@@ -4694,7 +4671,7 @@ var rcheckableType = ( /^(?:checkbox|radio)$/i );
4694
4671
 
4695
4672
  var rtagName = ( /<([a-z][^\/\0>\x20\t\r\n\f]+)/i );
4696
4673
 
4697
- var rscriptType = ( /^$|\/(?:java|ecma)script/i );
4674
+ var rscriptType = ( /^$|^module$|\/(?:java|ecma)script/i );
4698
4675
 
4699
4676
 
4700
4677
 
@@ -4776,7 +4753,7 @@ function buildFragment( elems, context, scripts, selection, ignored ) {
4776
4753
  if ( elem || elem === 0 ) {
4777
4754
 
4778
4755
  // Add nodes directly
4779
- if ( jQuery.type( elem ) === "object" ) {
4756
+ if ( toType( elem ) === "object" ) {
4780
4757
 
4781
4758
  // Support: Android <=4.0 only, PhantomJS 1 only
4782
4759
  // push.apply(_, arraylike) throws on ancient WebKit
@@ -5286,7 +5263,7 @@ jQuery.event = {
5286
5263
  enumerable: true,
5287
5264
  configurable: true,
5288
5265
 
5289
- get: jQuery.isFunction( hook ) ?
5266
+ get: isFunction( hook ) ?
5290
5267
  function() {
5291
5268
  if ( this.originalEvent ) {
5292
5269
  return hook( this.originalEvent );
@@ -5421,7 +5398,7 @@ jQuery.Event = function( src, props ) {
5421
5398
  }
5422
5399
 
5423
5400
  // Create a timestamp if incoming event doesn't have one
5424
- this.timeStamp = src && src.timeStamp || jQuery.now();
5401
+ this.timeStamp = src && src.timeStamp || Date.now();
5425
5402
 
5426
5403
  // Mark it as fixed
5427
5404
  this[ jQuery.expando ] = true;
@@ -5620,14 +5597,13 @@ var
5620
5597
 
5621
5598
  /* eslint-enable */
5622
5599
 
5623
- // Support: IE <=10 - 11, Edge 12 - 13
5600
+ // Support: IE <=10 - 11, Edge 12 - 13 only
5624
5601
  // In IE/Edge using regex groups here causes severe slowdowns.
5625
5602
  // See https://connect.microsoft.com/IE/feedback/details/1736512/
5626
5603
  rnoInnerhtml = /<script|<style|<link/i,
5627
5604
 
5628
5605
  // checked="checked" or checked
5629
5606
  rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
5630
- rscriptTypeMasked = /^true\/(.*)/,
5631
5607
  rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;
5632
5608
 
5633
5609
  // Prefer a tbody over its parent table for containing new rows
@@ -5635,7 +5611,7 @@ function manipulationTarget( elem, content ) {
5635
5611
  if ( nodeName( elem, "table" ) &&
5636
5612
  nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ) {
5637
5613
 
5638
- return jQuery( ">tbody", elem )[ 0 ] || elem;
5614
+ return jQuery( elem ).children( "tbody" )[ 0 ] || elem;
5639
5615
  }
5640
5616
 
5641
5617
  return elem;
@@ -5647,10 +5623,8 @@ function disableScript( elem ) {
5647
5623
  return elem;
5648
5624
  }
5649
5625
  function restoreScript( elem ) {
5650
- var match = rscriptTypeMasked.exec( elem.type );
5651
-
5652
- if ( match ) {
5653
- elem.type = match[ 1 ];
5626
+ if ( ( elem.type || "" ).slice( 0, 5 ) === "true/" ) {
5627
+ elem.type = elem.type.slice( 5 );
5654
5628
  } else {
5655
5629
  elem.removeAttribute( "type" );
5656
5630
  }
@@ -5716,15 +5690,15 @@ function domManip( collection, args, callback, ignored ) {
5716
5690
  l = collection.length,
5717
5691
  iNoClone = l - 1,
5718
5692
  value = args[ 0 ],
5719
- isFunction = jQuery.isFunction( value );
5693
+ valueIsFunction = isFunction( value );
5720
5694
 
5721
5695
  // We can't cloneNode fragments that contain checked, in WebKit
5722
- if ( isFunction ||
5696
+ if ( valueIsFunction ||
5723
5697
  ( l > 1 && typeof value === "string" &&
5724
5698
  !support.checkClone && rchecked.test( value ) ) ) {
5725
5699
  return collection.each( function( index ) {
5726
5700
  var self = collection.eq( index );
5727
- if ( isFunction ) {
5701
+ if ( valueIsFunction ) {
5728
5702
  args[ 0 ] = value.call( this, index, self.html() );
5729
5703
  }
5730
5704
  domManip( self, args, callback, ignored );
@@ -5778,14 +5752,14 @@ function domManip( collection, args, callback, ignored ) {
5778
5752
  !dataPriv.access( node, "globalEval" ) &&
5779
5753
  jQuery.contains( doc, node ) ) {
5780
5754
 
5781
- if ( node.src ) {
5755
+ if ( node.src && ( node.type || "" ).toLowerCase() !== "module" ) {
5782
5756
 
5783
5757
  // Optional AJAX dependency, but won't run scripts if not present
5784
5758
  if ( jQuery._evalUrl ) {
5785
5759
  jQuery._evalUrl( node.src );
5786
5760
  }
5787
5761
  } else {
5788
- DOMEval( node.textContent.replace( rcleanScript, "" ), doc );
5762
+ DOMEval( node.textContent.replace( rcleanScript, "" ), doc, node );
5789
5763
  }
5790
5764
  }
5791
5765
  }
@@ -6065,8 +6039,6 @@ jQuery.each( {
6065
6039
  return this.pushStack( ret );
6066
6040
  };
6067
6041
  } );
6068
- var rmargin = ( /^margin/ );
6069
-
6070
6042
  var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" );
6071
6043
 
6072
6044
  var getStyles = function( elem ) {
@@ -6083,6 +6055,8 @@ var getStyles = function( elem ) {
6083
6055
  return view.getComputedStyle( elem );
6084
6056
  };
6085
6057
 
6058
+ var rboxStyle = new RegExp( cssExpand.join( "|" ), "i" );
6059
+
6086
6060
 
6087
6061
 
6088
6062
  ( function() {
@@ -6096,25 +6070,33 @@ var getStyles = function( elem ) {
6096
6070
  return;
6097
6071
  }
6098
6072
 
6073
+ container.style.cssText = "position:absolute;left:-11111px;width:60px;" +
6074
+ "margin-top:1px;padding:0;border:0";
6099
6075
  div.style.cssText =
6100
- "box-sizing:border-box;" +
6101
- "position:relative;display:block;" +
6076
+ "position:relative;display:block;box-sizing:border-box;overflow:scroll;" +
6102
6077
  "margin:auto;border:1px;padding:1px;" +
6103
- "top:1%;width:50%";
6104
- div.innerHTML = "";
6105
- documentElement.appendChild( container );
6078
+ "width:60%;top:1%";
6079
+ documentElement.appendChild( container ).appendChild( div );
6106
6080
 
6107
6081
  var divStyle = window.getComputedStyle( div );
6108
6082
  pixelPositionVal = divStyle.top !== "1%";
6109
6083
 
6110
6084
  // Support: Android 4.0 - 4.3 only, Firefox <=3 - 44
6111
- reliableMarginLeftVal = divStyle.marginLeft === "2px";
6112
- boxSizingReliableVal = divStyle.width === "4px";
6085
+ reliableMarginLeftVal = roundPixelMeasures( divStyle.marginLeft ) === 12;
6113
6086
 
6114
- // Support: Android 4.0 - 4.3 only
6087
+ // Support: Android 4.0 - 4.3 only, Safari <=9.1 - 10.1, iOS <=7.0 - 9.3
6115
6088
  // Some styles come back with percentage values, even though they shouldn't
6116
- div.style.marginRight = "50%";
6117
- pixelMarginRightVal = divStyle.marginRight === "4px";
6089
+ div.style.right = "60%";
6090
+ pixelBoxStylesVal = roundPixelMeasures( divStyle.right ) === 36;
6091
+
6092
+ // Support: IE 9 - 11 only
6093
+ // Detect misreporting of content dimensions for box-sizing:border-box elements
6094
+ boxSizingReliableVal = roundPixelMeasures( divStyle.width ) === 36;
6095
+
6096
+ // Support: IE 9 only
6097
+ // Detect overflow:scroll screwiness (gh-3699)
6098
+ div.style.position = "absolute";
6099
+ scrollboxSizeVal = div.offsetWidth === 36 || "absolute";
6118
6100
 
6119
6101
  documentElement.removeChild( container );
6120
6102
 
@@ -6123,7 +6105,12 @@ var getStyles = function( elem ) {
6123
6105
  div = null;
6124
6106
  }
6125
6107
 
6126
- var pixelPositionVal, boxSizingReliableVal, pixelMarginRightVal, reliableMarginLeftVal,
6108
+ function roundPixelMeasures( measure ) {
6109
+ return Math.round( parseFloat( measure ) );
6110
+ }
6111
+
6112
+ var pixelPositionVal, boxSizingReliableVal, scrollboxSizeVal, pixelBoxStylesVal,
6113
+ reliableMarginLeftVal,
6127
6114
  container = document.createElement( "div" ),
6128
6115
  div = document.createElement( "div" );
6129
6116
 
@@ -6138,26 +6125,26 @@ var getStyles = function( elem ) {
6138
6125
  div.cloneNode( true ).style.backgroundClip = "";
6139
6126
  support.clearCloneStyle = div.style.backgroundClip === "content-box";
6140
6127
 
6141
- container.style.cssText = "border:0;width:8px;height:0;top:0;left:-9999px;" +
6142
- "padding:0;margin-top:1px;position:absolute";
6143
- container.appendChild( div );
6144
-
6145
6128
  jQuery.extend( support, {
6146
- pixelPosition: function() {
6147
- computeStyleTests();
6148
- return pixelPositionVal;
6149
- },
6150
6129
  boxSizingReliable: function() {
6151
6130
  computeStyleTests();
6152
6131
  return boxSizingReliableVal;
6153
6132
  },
6154
- pixelMarginRight: function() {
6133
+ pixelBoxStyles: function() {
6134
+ computeStyleTests();
6135
+ return pixelBoxStylesVal;
6136
+ },
6137
+ pixelPosition: function() {
6155
6138
  computeStyleTests();
6156
- return pixelMarginRightVal;
6139
+ return pixelPositionVal;
6157
6140
  },
6158
6141
  reliableMarginLeft: function() {
6159
6142
  computeStyleTests();
6160
6143
  return reliableMarginLeftVal;
6144
+ },
6145
+ scrollboxSize: function() {
6146
+ computeStyleTests();
6147
+ return scrollboxSizeVal;
6161
6148
  }
6162
6149
  } );
6163
6150
  } )();
@@ -6189,7 +6176,7 @@ function curCSS( elem, name, computed ) {
6189
6176
  // but width seems to be reliably pixels.
6190
6177
  // This is against the CSSOM draft spec:
6191
6178
  // https://drafts.csswg.org/cssom/#resolved-values
6192
- if ( !support.pixelMarginRight() && rnumnonpx.test( ret ) && rmargin.test( name ) ) {
6179
+ if ( !support.pixelBoxStyles() && rnumnonpx.test( ret ) && rboxStyle.test( name ) ) {
6193
6180
 
6194
6181
  // Remember the original values
6195
6182
  width = style.width;
@@ -6294,87 +6281,120 @@ function setPositiveNumber( elem, value, subtract ) {
6294
6281
  value;
6295
6282
  }
6296
6283
 
6297
- function augmentWidthOrHeight( elem, name, extra, isBorderBox, styles ) {
6298
- var i,
6299
- val = 0;
6300
-
6301
- // If we already have the right measurement, avoid augmentation
6302
- if ( extra === ( isBorderBox ? "border" : "content" ) ) {
6303
- i = 4;
6284
+ function boxModelAdjustment( elem, dimension, box, isBorderBox, styles, computedVal ) {
6285
+ var i = dimension === "width" ? 1 : 0,
6286
+ extra = 0,
6287
+ delta = 0;
6304
6288
 
6305
- // Otherwise initialize for horizontal or vertical properties
6306
- } else {
6307
- i = name === "width" ? 1 : 0;
6289
+ // Adjustment may not be necessary
6290
+ if ( box === ( isBorderBox ? "border" : "content" ) ) {
6291
+ return 0;
6308
6292
  }
6309
6293
 
6310
6294
  for ( ; i < 4; i += 2 ) {
6311
6295
 
6312
- // Both box models exclude margin, so add it if we want it
6313
- if ( extra === "margin" ) {
6314
- val += jQuery.css( elem, extra + cssExpand[ i ], true, styles );
6296
+ // Both box models exclude margin
6297
+ if ( box === "margin" ) {
6298
+ delta += jQuery.css( elem, box + cssExpand[ i ], true, styles );
6315
6299
  }
6316
6300
 
6317
- if ( isBorderBox ) {
6301
+ // If we get here with a content-box, we're seeking "padding" or "border" or "margin"
6302
+ if ( !isBorderBox ) {
6318
6303
 
6319
- // border-box includes padding, so remove it if we want content
6320
- if ( extra === "content" ) {
6321
- val -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
6322
- }
6304
+ // Add padding
6305
+ delta += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
6323
6306
 
6324
- // At this point, extra isn't border nor margin, so remove border
6325
- if ( extra !== "margin" ) {
6326
- val -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
6307
+ // For "border" or "margin", add border
6308
+ if ( box !== "padding" ) {
6309
+ delta += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
6310
+
6311
+ // But still keep track of it otherwise
6312
+ } else {
6313
+ extra += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
6327
6314
  }
6315
+
6316
+ // If we get here with a border-box (content + padding + border), we're seeking "content" or
6317
+ // "padding" or "margin"
6328
6318
  } else {
6329
6319
 
6330
- // At this point, extra isn't content, so add padding
6331
- val += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
6320
+ // For "content", subtract padding
6321
+ if ( box === "content" ) {
6322
+ delta -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
6323
+ }
6332
6324
 
6333
- // At this point, extra isn't content nor padding, so add border
6334
- if ( extra !== "padding" ) {
6335
- val += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
6325
+ // For "content" or "padding", subtract border
6326
+ if ( box !== "margin" ) {
6327
+ delta -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
6336
6328
  }
6337
6329
  }
6338
6330
  }
6339
6331
 
6340
- return val;
6332
+ // Account for positive content-box scroll gutter when requested by providing computedVal
6333
+ if ( !isBorderBox && computedVal >= 0 ) {
6334
+
6335
+ // offsetWidth/offsetHeight is a rounded sum of content, padding, scroll gutter, and border
6336
+ // Assuming integer scroll gutter, subtract the rest and round down
6337
+ delta += Math.max( 0, Math.ceil(
6338
+ elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] -
6339
+ computedVal -
6340
+ delta -
6341
+ extra -
6342
+ 0.5
6343
+ ) );
6344
+ }
6345
+
6346
+ return delta;
6341
6347
  }
6342
6348
 
6343
- function getWidthOrHeight( elem, name, extra ) {
6349
+ function getWidthOrHeight( elem, dimension, extra ) {
6344
6350
 
6345
6351
  // Start with computed style
6346
- var valueIsBorderBox,
6347
- styles = getStyles( elem ),
6348
- val = curCSS( elem, name, styles ),
6349
- isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box";
6352
+ var styles = getStyles( elem ),
6353
+ val = curCSS( elem, dimension, styles ),
6354
+ isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
6355
+ valueIsBorderBox = isBorderBox;
6350
6356
 
6351
- // Computed unit is not pixels. Stop here and return.
6357
+ // Support: Firefox <=54
6358
+ // Return a confounding non-pixel value or feign ignorance, as appropriate.
6352
6359
  if ( rnumnonpx.test( val ) ) {
6353
- return val;
6360
+ if ( !extra ) {
6361
+ return val;
6362
+ }
6363
+ val = "auto";
6354
6364
  }
6355
6365
 
6356
6366
  // Check for style in case a browser which returns unreliable values
6357
6367
  // for getComputedStyle silently falls back to the reliable elem.style
6358
- valueIsBorderBox = isBorderBox &&
6359
- ( support.boxSizingReliable() || val === elem.style[ name ] );
6368
+ valueIsBorderBox = valueIsBorderBox &&
6369
+ ( support.boxSizingReliable() || val === elem.style[ dimension ] );
6360
6370
 
6361
- // Fall back to offsetWidth/Height when value is "auto"
6371
+ // Fall back to offsetWidth/offsetHeight when value is "auto"
6362
6372
  // This happens for inline elements with no explicit setting (gh-3571)
6363
- if ( val === "auto" ) {
6364
- val = elem[ "offset" + name[ 0 ].toUpperCase() + name.slice( 1 ) ];
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" ) {
6377
+
6378
+ val = elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ];
6379
+
6380
+ // offsetWidth/offsetHeight provide border-box values
6381
+ valueIsBorderBox = true;
6365
6382
  }
6366
6383
 
6367
- // Normalize "", auto, and prepare for extra
6384
+ // Normalize "" and auto
6368
6385
  val = parseFloat( val ) || 0;
6369
6386
 
6370
- // Use the active box-sizing model to add/subtract irrelevant styles
6387
+ // Adjust for the element's box model
6371
6388
  return ( val +
6372
- augmentWidthOrHeight(
6389
+ boxModelAdjustment(
6373
6390
  elem,
6374
- name,
6391
+ dimension,
6375
6392
  extra || ( isBorderBox ? "border" : "content" ),
6376
6393
  valueIsBorderBox,
6377
- styles
6394
+ styles,
6395
+
6396
+ // Provide the current computed size to request scroll gutter calculation (gh-3589)
6397
+ val
6378
6398
  )
6379
6399
  ) + "px";
6380
6400
  }
@@ -6415,9 +6435,7 @@ jQuery.extend( {
6415
6435
 
6416
6436
  // Add in properties whose names you wish to fix before
6417
6437
  // setting or getting the value
6418
- cssProps: {
6419
- "float": "cssFloat"
6420
- },
6438
+ cssProps: {},
6421
6439
 
6422
6440
  // Get and set the style property on a DOM Node
6423
6441
  style: function( elem, name, value, extra ) {
@@ -6429,7 +6447,7 @@ jQuery.extend( {
6429
6447
 
6430
6448
  // Make sure that we're working with the right name
6431
6449
  var ret, type, hooks,
6432
- origName = jQuery.camelCase( name ),
6450
+ origName = camelCase( name ),
6433
6451
  isCustomProp = rcustomProp.test( name ),
6434
6452
  style = elem.style;
6435
6453
 
@@ -6497,7 +6515,7 @@ jQuery.extend( {
6497
6515
 
6498
6516
  css: function( elem, name, extra, styles ) {
6499
6517
  var val, num, hooks,
6500
- origName = jQuery.camelCase( name ),
6518
+ origName = camelCase( name ),
6501
6519
  isCustomProp = rcustomProp.test( name );
6502
6520
 
6503
6521
  // Make sure that we're working with the right name. We don't
@@ -6535,8 +6553,8 @@ jQuery.extend( {
6535
6553
  }
6536
6554
  } );
6537
6555
 
6538
- jQuery.each( [ "height", "width" ], function( i, name ) {
6539
- jQuery.cssHooks[ name ] = {
6556
+ jQuery.each( [ "height", "width" ], function( i, dimension ) {
6557
+ jQuery.cssHooks[ dimension ] = {
6540
6558
  get: function( elem, computed, extra ) {
6541
6559
  if ( computed ) {
6542
6560
 
@@ -6552,29 +6570,41 @@ jQuery.each( [ "height", "width" ], function( i, name ) {
6552
6570
  // in IE throws an error.
6553
6571
  ( !elem.getClientRects().length || !elem.getBoundingClientRect().width ) ?
6554
6572
  swap( elem, cssShow, function() {
6555
- return getWidthOrHeight( elem, name, extra );
6573
+ return getWidthOrHeight( elem, dimension, extra );
6556
6574
  } ) :
6557
- getWidthOrHeight( elem, name, extra );
6575
+ getWidthOrHeight( elem, dimension, extra );
6558
6576
  }
6559
6577
  },
6560
6578
 
6561
6579
  set: function( elem, value, extra ) {
6562
6580
  var matches,
6563
- styles = extra && getStyles( elem ),
6564
- subtract = extra && augmentWidthOrHeight(
6581
+ styles = getStyles( elem ),
6582
+ isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
6583
+ subtract = extra && boxModelAdjustment(
6565
6584
  elem,
6566
- name,
6585
+ dimension,
6567
6586
  extra,
6568
- jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
6587
+ isBorderBox,
6569
6588
  styles
6570
6589
  );
6571
6590
 
6591
+ // Account for unreliable border-box dimensions by comparing offset* to computed and
6592
+ // faking a content-box to get border and padding (gh-3699)
6593
+ if ( isBorderBox && support.scrollboxSize() === styles.position ) {
6594
+ subtract -= Math.ceil(
6595
+ elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] -
6596
+ parseFloat( styles[ dimension ] ) -
6597
+ boxModelAdjustment( elem, dimension, "border", false, styles ) -
6598
+ 0.5
6599
+ );
6600
+ }
6601
+
6572
6602
  // Convert to pixels if value adjustment is needed
6573
6603
  if ( subtract && ( matches = rcssNum.exec( value ) ) &&
6574
6604
  ( matches[ 3 ] || "px" ) !== "px" ) {
6575
6605
 
6576
- elem.style[ name ] = value;
6577
- value = jQuery.css( elem, name );
6606
+ elem.style[ dimension ] = value;
6607
+ value = jQuery.css( elem, dimension );
6578
6608
  }
6579
6609
 
6580
6610
  return setPositiveNumber( elem, value, subtract );
@@ -6618,7 +6648,7 @@ jQuery.each( {
6618
6648
  }
6619
6649
  };
6620
6650
 
6621
- if ( !rmargin.test( prefix ) ) {
6651
+ if ( prefix !== "margin" ) {
6622
6652
  jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber;
6623
6653
  }
6624
6654
  } );
@@ -6789,7 +6819,7 @@ function createFxNow() {
6789
6819
  window.setTimeout( function() {
6790
6820
  fxNow = undefined;
6791
6821
  } );
6792
- return ( fxNow = jQuery.now() );
6822
+ return ( fxNow = Date.now() );
6793
6823
  }
6794
6824
 
6795
6825
  // Generate parameters to create a standard animation
@@ -6893,9 +6923,10 @@ function defaultPrefilter( elem, props, opts ) {
6893
6923
  // Restrict "overflow" and "display" styles during box animations
6894
6924
  if ( isBox && elem.nodeType === 1 ) {
6895
6925
 
6896
- // Support: IE <=9 - 11, Edge 12 - 13
6926
+ // Support: IE <=9 - 11, Edge 12 - 15
6897
6927
  // Record all 3 overflow attributes because IE does not infer the shorthand
6898
- // from identically-valued overflowX and overflowY
6928
+ // from identically-valued overflowX and overflowY and Edge just mirrors
6929
+ // the overflowX value there.
6899
6930
  opts.overflow = [ style.overflow, style.overflowX, style.overflowY ];
6900
6931
 
6901
6932
  // Identify a display type, preferring old show/hide data over the CSS cascade
@@ -7003,7 +7034,7 @@ function propFilter( props, specialEasing ) {
7003
7034
 
7004
7035
  // camelCase, specialEasing and expand cssHook pass
7005
7036
  for ( index in props ) {
7006
- name = jQuery.camelCase( index );
7037
+ name = camelCase( index );
7007
7038
  easing = specialEasing[ name ];
7008
7039
  value = props[ index ];
7009
7040
  if ( Array.isArray( value ) ) {
@@ -7128,9 +7159,9 @@ function Animation( elem, properties, options ) {
7128
7159
  for ( ; index < length; index++ ) {
7129
7160
  result = Animation.prefilters[ index ].call( animation, elem, props, animation.opts );
7130
7161
  if ( result ) {
7131
- if ( jQuery.isFunction( result.stop ) ) {
7162
+ if ( isFunction( result.stop ) ) {
7132
7163
  jQuery._queueHooks( animation.elem, animation.opts.queue ).stop =
7133
- jQuery.proxy( result.stop, result );
7164
+ result.stop.bind( result );
7134
7165
  }
7135
7166
  return result;
7136
7167
  }
@@ -7138,7 +7169,7 @@ function Animation( elem, properties, options ) {
7138
7169
 
7139
7170
  jQuery.map( props, createTween, animation );
7140
7171
 
7141
- if ( jQuery.isFunction( animation.opts.start ) ) {
7172
+ if ( isFunction( animation.opts.start ) ) {
7142
7173
  animation.opts.start.call( elem, animation );
7143
7174
  }
7144
7175
 
@@ -7171,7 +7202,7 @@ jQuery.Animation = jQuery.extend( Animation, {
7171
7202
  },
7172
7203
 
7173
7204
  tweener: function( props, callback ) {
7174
- if ( jQuery.isFunction( props ) ) {
7205
+ if ( isFunction( props ) ) {
7175
7206
  callback = props;
7176
7207
  props = [ "*" ];
7177
7208
  } else {
@@ -7203,9 +7234,9 @@ jQuery.Animation = jQuery.extend( Animation, {
7203
7234
  jQuery.speed = function( speed, easing, fn ) {
7204
7235
  var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : {
7205
7236
  complete: fn || !fn && easing ||
7206
- jQuery.isFunction( speed ) && speed,
7237
+ isFunction( speed ) && speed,
7207
7238
  duration: speed,
7208
- easing: fn && easing || easing && !jQuery.isFunction( easing ) && easing
7239
+ easing: fn && easing || easing && !isFunction( easing ) && easing
7209
7240
  };
7210
7241
 
7211
7242
  // Go to the end state if fx are off
@@ -7232,7 +7263,7 @@ jQuery.speed = function( speed, easing, fn ) {
7232
7263
  opt.old = opt.complete;
7233
7264
 
7234
7265
  opt.complete = function() {
7235
- if ( jQuery.isFunction( opt.old ) ) {
7266
+ if ( isFunction( opt.old ) ) {
7236
7267
  opt.old.call( this );
7237
7268
  }
7238
7269
 
@@ -7396,7 +7427,7 @@ jQuery.fx.tick = function() {
7396
7427
  i = 0,
7397
7428
  timers = jQuery.timers;
7398
7429
 
7399
- fxNow = jQuery.now();
7430
+ fxNow = Date.now();
7400
7431
 
7401
7432
  for ( ; i < timers.length; i++ ) {
7402
7433
  timer = timers[ i ];
@@ -7749,7 +7780,7 @@ jQuery.each( [
7749
7780
 
7750
7781
 
7751
7782
  // Strip and collapse whitespace according to HTML spec
7752
- // https://html.spec.whatwg.org/multipage/infrastructure.html#strip-and-collapse-whitespace
7783
+ // https://infra.spec.whatwg.org/#strip-and-collapse-ascii-whitespace
7753
7784
  function stripAndCollapse( value ) {
7754
7785
  var tokens = value.match( rnothtmlwhite ) || [];
7755
7786
  return tokens.join( " " );
@@ -7760,20 +7791,30 @@ function getClass( elem ) {
7760
7791
  return elem.getAttribute && elem.getAttribute( "class" ) || "";
7761
7792
  }
7762
7793
 
7794
+ function classesToArray( value ) {
7795
+ if ( Array.isArray( value ) ) {
7796
+ return value;
7797
+ }
7798
+ if ( typeof value === "string" ) {
7799
+ return value.match( rnothtmlwhite ) || [];
7800
+ }
7801
+ return [];
7802
+ }
7803
+
7763
7804
  jQuery.fn.extend( {
7764
7805
  addClass: function( value ) {
7765
7806
  var classes, elem, cur, curValue, clazz, j, finalValue,
7766
7807
  i = 0;
7767
7808
 
7768
- if ( jQuery.isFunction( value ) ) {
7809
+ if ( isFunction( value ) ) {
7769
7810
  return this.each( function( j ) {
7770
7811
  jQuery( this ).addClass( value.call( this, j, getClass( this ) ) );
7771
7812
  } );
7772
7813
  }
7773
7814
 
7774
- if ( typeof value === "string" && value ) {
7775
- classes = value.match( rnothtmlwhite ) || [];
7815
+ classes = classesToArray( value );
7776
7816
 
7817
+ if ( classes.length ) {
7777
7818
  while ( ( elem = this[ i++ ] ) ) {
7778
7819
  curValue = getClass( elem );
7779
7820
  cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
@@ -7802,7 +7843,7 @@ jQuery.fn.extend( {
7802
7843
  var classes, elem, cur, curValue, clazz, j, finalValue,
7803
7844
  i = 0;
7804
7845
 
7805
- if ( jQuery.isFunction( value ) ) {
7846
+ if ( isFunction( value ) ) {
7806
7847
  return this.each( function( j ) {
7807
7848
  jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) );
7808
7849
  } );
@@ -7812,9 +7853,9 @@ jQuery.fn.extend( {
7812
7853
  return this.attr( "class", "" );
7813
7854
  }
7814
7855
 
7815
- if ( typeof value === "string" && value ) {
7816
- classes = value.match( rnothtmlwhite ) || [];
7856
+ classes = classesToArray( value );
7817
7857
 
7858
+ if ( classes.length ) {
7818
7859
  while ( ( elem = this[ i++ ] ) ) {
7819
7860
  curValue = getClass( elem );
7820
7861
 
@@ -7844,13 +7885,14 @@ jQuery.fn.extend( {
7844
7885
  },
7845
7886
 
7846
7887
  toggleClass: function( value, stateVal ) {
7847
- var type = typeof value;
7888
+ var type = typeof value,
7889
+ isValidValue = type === "string" || Array.isArray( value );
7848
7890
 
7849
- if ( typeof stateVal === "boolean" && type === "string" ) {
7891
+ if ( typeof stateVal === "boolean" && isValidValue ) {
7850
7892
  return stateVal ? this.addClass( value ) : this.removeClass( value );
7851
7893
  }
7852
7894
 
7853
- if ( jQuery.isFunction( value ) ) {
7895
+ if ( isFunction( value ) ) {
7854
7896
  return this.each( function( i ) {
7855
7897
  jQuery( this ).toggleClass(
7856
7898
  value.call( this, i, getClass( this ), stateVal ),
@@ -7862,12 +7904,12 @@ jQuery.fn.extend( {
7862
7904
  return this.each( function() {
7863
7905
  var className, i, self, classNames;
7864
7906
 
7865
- if ( type === "string" ) {
7907
+ if ( isValidValue ) {
7866
7908
 
7867
7909
  // Toggle individual class names
7868
7910
  i = 0;
7869
7911
  self = jQuery( this );
7870
- classNames = value.match( rnothtmlwhite ) || [];
7912
+ classNames = classesToArray( value );
7871
7913
 
7872
7914
  while ( ( className = classNames[ i++ ] ) ) {
7873
7915
 
@@ -7926,7 +7968,7 @@ var rreturn = /\r/g;
7926
7968
 
7927
7969
  jQuery.fn.extend( {
7928
7970
  val: function( value ) {
7929
- var hooks, ret, isFunction,
7971
+ var hooks, ret, valueIsFunction,
7930
7972
  elem = this[ 0 ];
7931
7973
 
7932
7974
  if ( !arguments.length ) {
@@ -7955,7 +7997,7 @@ jQuery.fn.extend( {
7955
7997
  return;
7956
7998
  }
7957
7999
 
7958
- isFunction = jQuery.isFunction( value );
8000
+ valueIsFunction = isFunction( value );
7959
8001
 
7960
8002
  return this.each( function( i ) {
7961
8003
  var val;
@@ -7964,7 +8006,7 @@ jQuery.fn.extend( {
7964
8006
  return;
7965
8007
  }
7966
8008
 
7967
- if ( isFunction ) {
8009
+ if ( valueIsFunction ) {
7968
8010
  val = value.call( this, i, jQuery( this ).val() );
7969
8011
  } else {
7970
8012
  val = value;
@@ -8106,18 +8148,24 @@ jQuery.each( [ "radio", "checkbox" ], function() {
8106
8148
  // Return jQuery for attributes-only inclusion
8107
8149
 
8108
8150
 
8109
- var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/;
8151
+ support.focusin = "onfocusin" in window;
8152
+
8153
+
8154
+ var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
8155
+ stopPropagationCallback = function( e ) {
8156
+ e.stopPropagation();
8157
+ };
8110
8158
 
8111
8159
  jQuery.extend( jQuery.event, {
8112
8160
 
8113
8161
  trigger: function( event, data, elem, onlyHandlers ) {
8114
8162
 
8115
- var i, cur, tmp, bubbleType, ontype, handle, special,
8163
+ var i, cur, tmp, bubbleType, ontype, handle, special, lastElement,
8116
8164
  eventPath = [ elem || document ],
8117
8165
  type = hasOwn.call( event, "type" ) ? event.type : event,
8118
8166
  namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split( "." ) : [];
8119
8167
 
8120
- cur = tmp = elem = elem || document;
8168
+ cur = lastElement = tmp = elem = elem || document;
8121
8169
 
8122
8170
  // Don't do events on text and comment nodes
8123
8171
  if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
@@ -8169,7 +8217,7 @@ jQuery.extend( jQuery.event, {
8169
8217
 
8170
8218
  // Determine event propagation path in advance, per W3C events spec (#9951)
8171
8219
  // Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
8172
- if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) {
8220
+ if ( !onlyHandlers && !special.noBubble && !isWindow( elem ) ) {
8173
8221
 
8174
8222
  bubbleType = special.delegateType || type;
8175
8223
  if ( !rfocusMorph.test( bubbleType + type ) ) {
@@ -8189,7 +8237,7 @@ jQuery.extend( jQuery.event, {
8189
8237
  // Fire handlers on the event path
8190
8238
  i = 0;
8191
8239
  while ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped() ) {
8192
-
8240
+ lastElement = cur;
8193
8241
  event.type = i > 1 ?
8194
8242
  bubbleType :
8195
8243
  special.bindType || type;
@@ -8221,7 +8269,7 @@ jQuery.extend( jQuery.event, {
8221
8269
 
8222
8270
  // Call a native DOM method on the target with the same name as the event.
8223
8271
  // Don't do default actions on window, that's where global variables be (#6170)
8224
- if ( ontype && jQuery.isFunction( elem[ type ] ) && !jQuery.isWindow( elem ) ) {
8272
+ if ( ontype && isFunction( elem[ type ] ) && !isWindow( elem ) ) {
8225
8273
 
8226
8274
  // Don't re-trigger an onFOO event when we call its FOO() method
8227
8275
  tmp = elem[ ontype ];
@@ -8232,7 +8280,17 @@ jQuery.extend( jQuery.event, {
8232
8280
 
8233
8281
  // Prevent re-triggering of the same event, since we already bubbled it above
8234
8282
  jQuery.event.triggered = type;
8283
+
8284
+ if ( event.isPropagationStopped() ) {
8285
+ lastElement.addEventListener( type, stopPropagationCallback );
8286
+ }
8287
+
8235
8288
  elem[ type ]();
8289
+
8290
+ if ( event.isPropagationStopped() ) {
8291
+ lastElement.removeEventListener( type, stopPropagationCallback );
8292
+ }
8293
+
8236
8294
  jQuery.event.triggered = undefined;
8237
8295
 
8238
8296
  if ( tmp ) {
@@ -8278,31 +8336,6 @@ jQuery.fn.extend( {
8278
8336
  } );
8279
8337
 
8280
8338
 
8281
- jQuery.each( ( "blur focus focusin focusout resize scroll click dblclick " +
8282
- "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
8283
- "change select submit keydown keypress keyup contextmenu" ).split( " " ),
8284
- function( i, name ) {
8285
-
8286
- // Handle event binding
8287
- jQuery.fn[ name ] = function( data, fn ) {
8288
- return arguments.length > 0 ?
8289
- this.on( name, null, data, fn ) :
8290
- this.trigger( name );
8291
- };
8292
- } );
8293
-
8294
- jQuery.fn.extend( {
8295
- hover: function( fnOver, fnOut ) {
8296
- return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
8297
- }
8298
- } );
8299
-
8300
-
8301
-
8302
-
8303
- support.focusin = "onfocusin" in window;
8304
-
8305
-
8306
8339
  // Support: Firefox <=44
8307
8340
  // Firefox doesn't have focus(in | out) events
8308
8341
  // Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787
@@ -8346,7 +8379,7 @@ if ( !support.focusin ) {
8346
8379
  }
8347
8380
  var location = window.location;
8348
8381
 
8349
- var nonce = jQuery.now();
8382
+ var nonce = Date.now();
8350
8383
 
8351
8384
  var rquery = ( /\?/ );
8352
8385
 
@@ -8404,7 +8437,7 @@ function buildParams( prefix, obj, traditional, add ) {
8404
8437
  }
8405
8438
  } );
8406
8439
 
8407
- } else if ( !traditional && jQuery.type( obj ) === "object" ) {
8440
+ } else if ( !traditional && toType( obj ) === "object" ) {
8408
8441
 
8409
8442
  // Serialize object item.
8410
8443
  for ( name in obj ) {
@@ -8426,7 +8459,7 @@ jQuery.param = function( a, traditional ) {
8426
8459
  add = function( key, valueOrFunction ) {
8427
8460
 
8428
8461
  // If value is a function, invoke it and use its return value
8429
- var value = jQuery.isFunction( valueOrFunction ) ?
8462
+ var value = isFunction( valueOrFunction ) ?
8430
8463
  valueOrFunction() :
8431
8464
  valueOrFunction;
8432
8465
 
@@ -8544,7 +8577,7 @@ function addToPrefiltersOrTransports( structure ) {
8544
8577
  i = 0,
8545
8578
  dataTypes = dataTypeExpression.toLowerCase().match( rnothtmlwhite ) || [];
8546
8579
 
8547
- if ( jQuery.isFunction( func ) ) {
8580
+ if ( isFunction( func ) ) {
8548
8581
 
8549
8582
  // For each dataType in the dataTypeExpression
8550
8583
  while ( ( dataType = dataTypes[ i++ ] ) ) {
@@ -9016,7 +9049,7 @@ jQuery.extend( {
9016
9049
  if ( s.crossDomain == null ) {
9017
9050
  urlAnchor = document.createElement( "a" );
9018
9051
 
9019
- // Support: IE <=8 - 11, Edge 12 - 13
9052
+ // Support: IE <=8 - 11, Edge 12 - 15
9020
9053
  // IE throws exception on accessing the href property if url is malformed,
9021
9054
  // e.g. http://example.com:80x/
9022
9055
  try {
@@ -9074,8 +9107,8 @@ jQuery.extend( {
9074
9107
  // Remember the hash so we can put it back
9075
9108
  uncached = s.url.slice( cacheURL.length );
9076
9109
 
9077
- // If data is available, append data to url
9078
- if ( s.data ) {
9110
+ // If data is available and should be processed, append data to url
9111
+ if ( s.data && ( s.processData || typeof s.data === "string" ) ) {
9079
9112
  cacheURL += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data;
9080
9113
 
9081
9114
  // #9682: remove data so that it's not used in an eventual retry
@@ -9312,7 +9345,7 @@ jQuery.each( [ "get", "post" ], function( i, method ) {
9312
9345
  jQuery[ method ] = function( url, data, callback, type ) {
9313
9346
 
9314
9347
  // Shift arguments if data argument was omitted
9315
- if ( jQuery.isFunction( data ) ) {
9348
+ if ( isFunction( data ) ) {
9316
9349
  type = type || callback;
9317
9350
  callback = data;
9318
9351
  data = undefined;
@@ -9350,7 +9383,7 @@ jQuery.fn.extend( {
9350
9383
  var wrap;
9351
9384
 
9352
9385
  if ( this[ 0 ] ) {
9353
- if ( jQuery.isFunction( html ) ) {
9386
+ if ( isFunction( html ) ) {
9354
9387
  html = html.call( this[ 0 ] );
9355
9388
  }
9356
9389
 
@@ -9376,7 +9409,7 @@ jQuery.fn.extend( {
9376
9409
  },
9377
9410
 
9378
9411
  wrapInner: function( html ) {
9379
- if ( jQuery.isFunction( html ) ) {
9412
+ if ( isFunction( html ) ) {
9380
9413
  return this.each( function( i ) {
9381
9414
  jQuery( this ).wrapInner( html.call( this, i ) );
9382
9415
  } );
@@ -9396,10 +9429,10 @@ jQuery.fn.extend( {
9396
9429
  },
9397
9430
 
9398
9431
  wrap: function( html ) {
9399
- var isFunction = jQuery.isFunction( html );
9432
+ var htmlIsFunction = isFunction( html );
9400
9433
 
9401
9434
  return this.each( function( i ) {
9402
- jQuery( this ).wrapAll( isFunction ? html.call( this, i ) : html );
9435
+ jQuery( this ).wrapAll( htmlIsFunction ? html.call( this, i ) : html );
9403
9436
  } );
9404
9437
  },
9405
9438
 
@@ -9491,7 +9524,8 @@ jQuery.ajaxTransport( function( options ) {
9491
9524
  return function() {
9492
9525
  if ( callback ) {
9493
9526
  callback = errorCallback = xhr.onload =
9494
- xhr.onerror = xhr.onabort = xhr.onreadystatechange = null;
9527
+ xhr.onerror = xhr.onabort = xhr.ontimeout =
9528
+ xhr.onreadystatechange = null;
9495
9529
 
9496
9530
  if ( type === "abort" ) {
9497
9531
  xhr.abort();
@@ -9531,7 +9565,7 @@ jQuery.ajaxTransport( function( options ) {
9531
9565
 
9532
9566
  // Listen to events
9533
9567
  xhr.onload = callback();
9534
- errorCallback = xhr.onerror = callback( "error" );
9568
+ errorCallback = xhr.onerror = xhr.ontimeout = callback( "error" );
9535
9569
 
9536
9570
  // Support: IE 9 only
9537
9571
  // Use onreadystatechange to replace onabort
@@ -9685,7 +9719,7 @@ jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
9685
9719
  if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) {
9686
9720
 
9687
9721
  // Get callback name, remembering preexisting value associated with it
9688
- callbackName = s.jsonpCallback = jQuery.isFunction( s.jsonpCallback ) ?
9722
+ callbackName = s.jsonpCallback = isFunction( s.jsonpCallback ) ?
9689
9723
  s.jsonpCallback() :
9690
9724
  s.jsonpCallback;
9691
9725
 
@@ -9736,7 +9770,7 @@ jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
9736
9770
  }
9737
9771
 
9738
9772
  // Call if it was a function and we have a response
9739
- if ( responseContainer && jQuery.isFunction( overwritten ) ) {
9773
+ if ( responseContainer && isFunction( overwritten ) ) {
9740
9774
  overwritten( responseContainer[ 0 ] );
9741
9775
  }
9742
9776
 
@@ -9828,7 +9862,7 @@ jQuery.fn.load = function( url, params, callback ) {
9828
9862
  }
9829
9863
 
9830
9864
  // If it's a function
9831
- if ( jQuery.isFunction( params ) ) {
9865
+ if ( isFunction( params ) ) {
9832
9866
 
9833
9867
  // We assume that it's the callback
9834
9868
  callback = params;
@@ -9936,7 +9970,7 @@ jQuery.offset = {
9936
9970
  curLeft = parseFloat( curCSSLeft ) || 0;
9937
9971
  }
9938
9972
 
9939
- if ( jQuery.isFunction( options ) ) {
9973
+ if ( isFunction( options ) ) {
9940
9974
 
9941
9975
  // Use jQuery.extend here to allow modification of coordinates argument (gh-1848)
9942
9976
  options = options.call( elem, i, jQuery.extend( {}, curOffset ) );
@@ -9959,6 +9993,8 @@ jQuery.offset = {
9959
9993
  };
9960
9994
 
9961
9995
  jQuery.fn.extend( {
9996
+
9997
+ // offset() relates an element's border box to the document origin
9962
9998
  offset: function( options ) {
9963
9999
 
9964
10000
  // Preserve chaining for setter
@@ -9970,7 +10006,7 @@ jQuery.fn.extend( {
9970
10006
  } );
9971
10007
  }
9972
10008
 
9973
- var doc, docElem, rect, win,
10009
+ var rect, win,
9974
10010
  elem = this[ 0 ];
9975
10011
 
9976
10012
  if ( !elem ) {
@@ -9985,50 +10021,52 @@ jQuery.fn.extend( {
9985
10021
  return { top: 0, left: 0 };
9986
10022
  }
9987
10023
 
10024
+ // Get document-relative position by adding viewport scroll to viewport-relative gBCR
9988
10025
  rect = elem.getBoundingClientRect();
9989
-
9990
- doc = elem.ownerDocument;
9991
- docElem = doc.documentElement;
9992
- win = doc.defaultView;
9993
-
10026
+ win = elem.ownerDocument.defaultView;
9994
10027
  return {
9995
- top: rect.top + win.pageYOffset - docElem.clientTop,
9996
- left: rect.left + win.pageXOffset - docElem.clientLeft
10028
+ top: rect.top + win.pageYOffset,
10029
+ left: rect.left + win.pageXOffset
9997
10030
  };
9998
10031
  },
9999
10032
 
10033
+ // position() relates an element's margin box to its offset parent's padding box
10034
+ // This corresponds to the behavior of CSS absolute positioning
10000
10035
  position: function() {
10001
10036
  if ( !this[ 0 ] ) {
10002
10037
  return;
10003
10038
  }
10004
10039
 
10005
- var offsetParent, offset,
10040
+ var offsetParent, offset, doc,
10006
10041
  elem = this[ 0 ],
10007
10042
  parentOffset = { top: 0, left: 0 };
10008
10043
 
10009
- // Fixed elements are offset from window (parentOffset = {top:0, left: 0},
10010
- // because it is its only offset parent
10044
+ // position:fixed elements are offset from the viewport, which itself always has zero offset
10011
10045
  if ( jQuery.css( elem, "position" ) === "fixed" ) {
10012
10046
 
10013
- // Assume getBoundingClientRect is there when computed position is fixed
10047
+ // Assume position:fixed implies availability of getBoundingClientRect
10014
10048
  offset = elem.getBoundingClientRect();
10015
10049
 
10016
10050
  } else {
10051
+ offset = this.offset();
10017
10052
 
10018
- // Get *real* offsetParent
10019
- offsetParent = this.offsetParent();
10053
+ // Account for the *real* offset parent, which can be the document or its root element
10054
+ // when a statically positioned element is identified
10055
+ doc = elem.ownerDocument;
10056
+ offsetParent = elem.offsetParent || doc.documentElement;
10057
+ while ( offsetParent &&
10058
+ ( offsetParent === doc.body || offsetParent === doc.documentElement ) &&
10059
+ jQuery.css( offsetParent, "position" ) === "static" ) {
10020
10060
 
10021
- // Get correct offsets
10022
- offset = this.offset();
10023
- if ( !nodeName( offsetParent[ 0 ], "html" ) ) {
10024
- parentOffset = offsetParent.offset();
10061
+ offsetParent = offsetParent.parentNode;
10025
10062
  }
10063
+ if ( offsetParent && offsetParent !== elem && offsetParent.nodeType === 1 ) {
10026
10064
 
10027
- // Add offsetParent borders
10028
- parentOffset = {
10029
- top: parentOffset.top + jQuery.css( offsetParent[ 0 ], "borderTopWidth", true ),
10030
- left: parentOffset.left + jQuery.css( offsetParent[ 0 ], "borderLeftWidth", true )
10031
- };
10065
+ // Incorporate borders into its offset, since they are outside its content origin
10066
+ parentOffset = jQuery( offsetParent ).offset();
10067
+ parentOffset.top += jQuery.css( offsetParent, "borderTopWidth", true );
10068
+ parentOffset.left += jQuery.css( offsetParent, "borderLeftWidth", true );
10069
+ }
10032
10070
  }
10033
10071
 
10034
10072
  // Subtract parent offsets and element margins
@@ -10070,7 +10108,7 @@ jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function(
10070
10108
 
10071
10109
  // Coalesce documents and windows
10072
10110
  var win;
10073
- if ( jQuery.isWindow( elem ) ) {
10111
+ if ( isWindow( elem ) ) {
10074
10112
  win = elem;
10075
10113
  } else if ( elem.nodeType === 9 ) {
10076
10114
  win = elem.defaultView;
@@ -10128,7 +10166,7 @@ jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
10128
10166
  return access( this, function( elem, type, value ) {
10129
10167
  var doc;
10130
10168
 
10131
- if ( jQuery.isWindow( elem ) ) {
10169
+ if ( isWindow( elem ) ) {
10132
10170
 
10133
10171
  // $( window ).outerWidth/Height return w/h including scrollbars (gh-1729)
10134
10172
  return funcName.indexOf( "outer" ) === 0 ?
@@ -10162,6 +10200,28 @@ jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
10162
10200
  } );
10163
10201
 
10164
10202
 
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 );
10213
+ };
10214
+ } );
10215
+
10216
+ jQuery.fn.extend( {
10217
+ hover: function( fnOver, fnOut ) {
10218
+ return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
10219
+ }
10220
+ } );
10221
+
10222
+
10223
+
10224
+
10165
10225
  jQuery.fn.extend( {
10166
10226
 
10167
10227
  bind: function( types, data, fn ) {
@@ -10183,6 +10243,37 @@ jQuery.fn.extend( {
10183
10243
  }
10184
10244
  } );
10185
10245
 
10246
+ // Bind a function to a context, optionally partially applying any
10247
+ // arguments.
10248
+ // jQuery.proxy is deprecated to promote standards (specifically Function#bind)
10249
+ // However, it is not slated for removal any time soon
10250
+ jQuery.proxy = function( fn, context ) {
10251
+ var tmp, args, proxy;
10252
+
10253
+ if ( typeof context === "string" ) {
10254
+ tmp = fn[ context ];
10255
+ context = fn;
10256
+ fn = tmp;
10257
+ }
10258
+
10259
+ // Quick check to determine if target is callable, in the spec
10260
+ // this throws a TypeError, but we will just return undefined.
10261
+ if ( !isFunction( fn ) ) {
10262
+ return undefined;
10263
+ }
10264
+
10265
+ // Simulated bind
10266
+ args = slice.call( arguments, 2 );
10267
+ proxy = function() {
10268
+ return fn.apply( context || this, args.concat( slice.call( arguments ) ) );
10269
+ };
10270
+
10271
+ // Set the guid of unique handler to the same of original handler, so it can be removed
10272
+ proxy.guid = fn.guid = fn.guid || jQuery.guid++;
10273
+
10274
+ return proxy;
10275
+ };
10276
+
10186
10277
  jQuery.holdReady = function( hold ) {
10187
10278
  if ( hold ) {
10188
10279
  jQuery.readyWait++;
@@ -10193,6 +10284,26 @@ jQuery.holdReady = function( hold ) {
10193
10284
  jQuery.isArray = Array.isArray;
10194
10285
  jQuery.parseJSON = JSON.parse;
10195
10286
  jQuery.nodeName = nodeName;
10287
+ jQuery.isFunction = isFunction;
10288
+ jQuery.isWindow = isWindow;
10289
+ jQuery.camelCase = camelCase;
10290
+ jQuery.type = toType;
10291
+
10292
+ jQuery.now = Date.now;
10293
+
10294
+ jQuery.isNumeric = function( obj ) {
10295
+
10296
+ // As of jQuery 3.0, isNumeric is limited to
10297
+ // strings and numbers (primitives or objects)
10298
+ // that can be coerced to finite numbers (gh-2662)
10299
+ var type = jQuery.type( obj );
10300
+ return ( type === "number" || type === "string" ) &&
10301
+
10302
+ // parseFloat NaNs numeric-cast false positives ("")
10303
+ // ...but misinterprets leading-number strings, particularly hex literals ("0x...")
10304
+ // subtraction forces infinities to NaN
10305
+ !isNaN( obj - parseFloat( obj ) );
10306
+ };
10196
10307
 
10197
10308
 
10198
10309