jquery-rails 4.2.2 → 4.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

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
2
  SHA1:
3
- metadata.gz: 7996d2fc15acd7a01d2f6647ade819334d057331
4
- data.tar.gz: 418862a8521eb9e60228fc51a6b097884a0d100c
3
+ metadata.gz: 8c5d85690ee85928e2a30da55fa2b5aef44b96ed
4
+ data.tar.gz: 9c89df4fbd6151582e4db8681690234da7528309
5
5
  SHA512:
6
- metadata.gz: 90076a29f609f4ed19417362c4634dff8bb76887dfc468cd2c60722d7a1dd82d54245b6e370b02216a1e1caf0f12f8dba4331f8bb2f0ef7102475a1dfefd3be8
7
- data.tar.gz: b60271df7f41e49c343f6159f664fb752645efd5c62b395172ca91f64d19334465adc8b7afba10e4d323f4bfcc50af34e4b598699cb645bf3af3adf8b9e56f34
6
+ metadata.gz: 2309598856c6a21cfea1dde8f8261b992641f6c6711fe87b508af6ab82e44675c5e8c75d4f670282186e25637ab4a557248c3f08639bd183ae06a994aecffcd5
7
+ data.tar.gz: b8e53ac98827eba878369fa1e3ed6f94c35be7fa91bf2f7a4812fbf6345d16474fec5689520a7cb8f5911b78be3818dd9bc2272a719174270ab41cef87b5e824
data/CHANGELOG.md CHANGED
@@ -1,3 +1,12 @@
1
+ ## 4.3.1
2
+
3
+ - update jquery to 3.2.1
4
+
5
+ ## 4.3.0
6
+
7
+ - update jquery to 3.2.0
8
+ - Add possibility to test HTML attribute selectors
9
+
1
10
  ## 4.2.2
2
11
 
3
12
  - update jquery to 3.1.1
data/Gemfile CHANGED
@@ -12,5 +12,11 @@ else
12
12
  gem 'json', '~> 1.8.0'
13
13
  end
14
14
 
15
+ if RUBY_VERSION >= '2.1'
16
+ gem 'nokogiri'
17
+ else
18
+ gem 'nokogiri', '~> 1.6.0'
19
+ end
20
+
15
21
  # Specify your gem's dependencies in jquery-rails.gemspec
16
22
  gemspec
data/VERSIONS.md CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  | Gem | jQuery | jQuery UJS | jQuery UI |
4
4
  |--------|--------|------------| ----------|
5
+ | 4.3.1 | 1.12.4 & 2.2.4 & 3.2.1 | 1.2.2 | - |
6
+ | 4.3.0 | 1.12.4 & 2.2.4 & 3.2.0 | 1.2.2 | - |
5
7
  | 4.2.2 | 1.12.4 & 2.2.4 & 3.1.1 | 1.2.2 | - |
6
8
  | 4.2.1 | 1.12.4 & 2.2.4 & 3.1.0 | 1.2.2 | - |
7
9
  | 4.2.0 | 1.12.4 & 2.2.4 & 3.0.0 | 1.2.2 | - |
@@ -54,7 +54,7 @@ module Rails::Dom::Testing::Assertions::SelectorAssertions
54
54
  def assert_select_jquery(*args, &block)
55
55
  jquery_method = args.first.is_a?(Symbol) ? args.shift : nil
56
56
  jquery_opt = args.first.is_a?(Symbol) ? args.shift : nil
57
- id = args.first.is_a?(String) ? args.shift : nil
57
+ id = args.first.is_a?(String) ? escape_id(args.shift) : nil
58
58
 
59
59
  target_pattern = "['\"]#{id || '.*'}['\"]"
60
60
  method_pattern = "#{jquery_method || '\\w+'}"
@@ -128,4 +128,13 @@ module Rails::Dom::Testing::Assertions::SelectorAssertions
128
128
  unescaped.gsub!(PATTERN_UNICODE_ESCAPED_CHAR) {|u| [$1.hex].pack('U*')}
129
129
  unescaped
130
130
  end
131
+
132
+ def escape_id(selector)
133
+ return unless selector
134
+
135
+ id = selector.gsub('[', '\[')
136
+ id.gsub!(']', '\]')
137
+
138
+ id
139
+ end
131
140
  end
@@ -1,9 +1,9 @@
1
1
  module Jquery
2
2
  module Rails
3
- VERSION = "4.2.2"
3
+ VERSION = "4.3.1"
4
4
  JQUERY_VERSION = "1.12.4"
5
5
  JQUERY_2_VERSION = "2.2.4"
6
- JQUERY_3_VERSION = "3.1.1"
6
+ JQUERY_3_VERSION = "3.2.1"
7
7
  JQUERY_UJS_VERSION = "1.2.2"
8
8
  end
9
9
  end
@@ -13,6 +13,7 @@ class AssertSelectJQueryTest < ActiveSupport::TestCase
13
13
  jQuery("<div><p>something</p></div>").prependTo("#id");
14
14
  $('#id').remove();
15
15
  jQuery("#id").hide();
16
+ $("[data-placeholder~=name]").remove();
16
17
  JS
17
18
 
18
19
  setup do
@@ -28,6 +29,7 @@ class AssertSelectJQueryTest < ActiveSupport::TestCase
28
29
  assert_select_jquery :replaceWith, '#id' do
29
30
  assert_select 'p', 'something'
30
31
  end
32
+ assert_select_jquery :remove, "[data-placeholder~=name]"
31
33
  end
32
34
 
33
35
  assert_raise Minitest::Assertion, "No JQuery call matches [:show, :some_wrong]" do
@@ -1,15 +1,15 @@
1
1
  /*!
2
- * jQuery JavaScript Library v3.1.1
2
+ * jQuery JavaScript Library v3.2.1
3
3
  * https://jquery.com/
4
4
  *
5
5
  * Includes Sizzle.js
6
6
  * https://sizzlejs.com/
7
7
  *
8
- * Copyright jQuery Foundation and other contributors
8
+ * Copyright JS Foundation and other contributors
9
9
  * Released under the MIT license
10
10
  * https://jquery.org/license
11
11
  *
12
- * Date: 2016-09-22T22:30Z
12
+ * Date: 2017-03-20T18:59Z
13
13
  */
14
14
  ( function( global, factory ) {
15
15
 
@@ -88,7 +88,7 @@ var support = {};
88
88
 
89
89
 
90
90
  var
91
- version = "3.1.1",
91
+ version = "3.2.1",
92
92
 
93
93
  // Define a local copy of jQuery
94
94
  jQuery = function( selector, context ) {
@@ -236,11 +236,11 @@ jQuery.extend = jQuery.fn.extend = function() {
236
236
 
237
237
  // Recurse if we're merging plain objects or arrays
238
238
  if ( deep && copy && ( jQuery.isPlainObject( copy ) ||
239
- ( copyIsArray = jQuery.isArray( copy ) ) ) ) {
239
+ ( copyIsArray = Array.isArray( copy ) ) ) ) {
240
240
 
241
241
  if ( copyIsArray ) {
242
242
  copyIsArray = false;
243
- clone = src && jQuery.isArray( src ) ? src : [];
243
+ clone = src && Array.isArray( src ) ? src : [];
244
244
 
245
245
  } else {
246
246
  clone = src && jQuery.isPlainObject( src ) ? src : {};
@@ -279,8 +279,6 @@ jQuery.extend( {
279
279
  return jQuery.type( obj ) === "function";
280
280
  },
281
281
 
282
- isArray: Array.isArray,
283
-
284
282
  isWindow: function( obj ) {
285
283
  return obj != null && obj === obj.window;
286
284
  },
@@ -355,10 +353,6 @@ jQuery.extend( {
355
353
  return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
356
354
  },
357
355
 
358
- nodeName: function( elem, name ) {
359
- return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
360
- },
361
-
362
356
  each: function( obj, callback ) {
363
357
  var length, i = 0;
364
358
 
@@ -2843,6 +2837,13 @@ var siblings = function( n, elem ) {
2843
2837
 
2844
2838
  var rneedsContext = jQuery.expr.match.needsContext;
2845
2839
 
2840
+
2841
+
2842
+ function nodeName( elem, name ) {
2843
+
2844
+ return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
2845
+
2846
+ };
2846
2847
  var rsingleTag = ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i );
2847
2848
 
2848
2849
 
@@ -3194,7 +3195,18 @@ jQuery.each( {
3194
3195
  return siblings( elem.firstChild );
3195
3196
  },
3196
3197
  contents: function( elem ) {
3197
- return elem.contentDocument || jQuery.merge( [], elem.childNodes );
3198
+ if ( nodeName( elem, "iframe" ) ) {
3199
+ return elem.contentDocument;
3200
+ }
3201
+
3202
+ // Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only
3203
+ // Treat the template element as a regular one in browsers that
3204
+ // don't support it.
3205
+ if ( nodeName( elem, "template" ) ) {
3206
+ elem = elem.content || elem;
3207
+ }
3208
+
3209
+ return jQuery.merge( [], elem.childNodes );
3198
3210
  }
3199
3211
  }, function( name, fn ) {
3200
3212
  jQuery.fn[ name ] = function( until, selector ) {
@@ -3292,7 +3304,7 @@ jQuery.Callbacks = function( options ) {
3292
3304
  fire = function() {
3293
3305
 
3294
3306
  // Enforce single-firing
3295
- locked = options.once;
3307
+ locked = locked || options.once;
3296
3308
 
3297
3309
  // Execute callbacks for all pending executions,
3298
3310
  // respecting firingIndex overrides and runtime changes
@@ -3461,7 +3473,7 @@ function Thrower( ex ) {
3461
3473
  throw ex;
3462
3474
  }
3463
3475
 
3464
- function adoptValue( value, resolve, reject ) {
3476
+ function adoptValue( value, resolve, reject, noValue ) {
3465
3477
  var method;
3466
3478
 
3467
3479
  try {
@@ -3477,9 +3489,10 @@ function adoptValue( value, resolve, reject ) {
3477
3489
  // Other non-thenables
3478
3490
  } else {
3479
3491
 
3480
- // Support: Android 4.0 only
3481
- // Strict mode functions invoked without .call/.apply get global-object context
3482
- resolve.call( undefined, value );
3492
+ // Control `resolve` arguments by letting Array#slice cast boolean `noValue` to integer:
3493
+ // * false: [ value ].slice( 0 ) => resolve( value )
3494
+ // * true: [ value ].slice( 1 ) => resolve()
3495
+ resolve.apply( undefined, [ value ].slice( noValue ) );
3483
3496
  }
3484
3497
 
3485
3498
  // For Promises/A+, convert exceptions into rejections
@@ -3489,7 +3502,7 @@ function adoptValue( value, resolve, reject ) {
3489
3502
 
3490
3503
  // Support: Android 4.0 only
3491
3504
  // Strict mode functions invoked without .call/.apply get global-object context
3492
- reject.call( undefined, value );
3505
+ reject.apply( undefined, [ value ] );
3493
3506
  }
3494
3507
  }
3495
3508
 
@@ -3814,7 +3827,8 @@ jQuery.extend( {
3814
3827
 
3815
3828
  // Single- and empty arguments are adopted like Promise.resolve
3816
3829
  if ( remaining <= 1 ) {
3817
- adoptValue( singleValue, master.done( updateFunc( i ) ).resolve, master.reject );
3830
+ adoptValue( singleValue, master.done( updateFunc( i ) ).resolve, master.reject,
3831
+ !remaining );
3818
3832
 
3819
3833
  // Use .then() to unwrap secondary thenables (cf. gh-3000)
3820
3834
  if ( master.state() === "pending" ||
@@ -3886,15 +3900,6 @@ jQuery.extend( {
3886
3900
  // the ready event fires. See #6781
3887
3901
  readyWait: 1,
3888
3902
 
3889
- // Hold (or release) the ready event
3890
- holdReady: function( hold ) {
3891
- if ( hold ) {
3892
- jQuery.readyWait++;
3893
- } else {
3894
- jQuery.ready( true );
3895
- }
3896
- },
3897
-
3898
3903
  // Handle when the DOM is ready
3899
3904
  ready: function( wait ) {
3900
3905
 
@@ -4130,7 +4135,7 @@ Data.prototype = {
4130
4135
  if ( key !== undefined ) {
4131
4136
 
4132
4137
  // Support array or space separated string of keys
4133
- if ( jQuery.isArray( key ) ) {
4138
+ if ( Array.isArray( key ) ) {
4134
4139
 
4135
4140
  // If key is an array of keys...
4136
4141
  // We always set camelCase keys, so remove that.
@@ -4356,7 +4361,7 @@ jQuery.extend( {
4356
4361
 
4357
4362
  // Speed up dequeue by getting out quickly if this is just a lookup
4358
4363
  if ( data ) {
4359
- if ( !queue || jQuery.isArray( data ) ) {
4364
+ if ( !queue || Array.isArray( data ) ) {
4360
4365
  queue = dataPriv.access( elem, type, jQuery.makeArray( data ) );
4361
4366
  } else {
4362
4367
  queue.push( data );
@@ -4733,7 +4738,7 @@ function getAll( context, tag ) {
4733
4738
  ret = [];
4734
4739
  }
4735
4740
 
4736
- if ( tag === undefined || tag && jQuery.nodeName( context, tag ) ) {
4741
+ if ( tag === undefined || tag && nodeName( context, tag ) ) {
4737
4742
  return jQuery.merge( [ context ], ret );
4738
4743
  }
4739
4744
 
@@ -5340,7 +5345,7 @@ jQuery.event = {
5340
5345
 
5341
5346
  // For checkbox, fire native event so checked state will be right
5342
5347
  trigger: function() {
5343
- if ( this.type === "checkbox" && this.click && jQuery.nodeName( this, "input" ) ) {
5348
+ if ( this.type === "checkbox" && this.click && nodeName( this, "input" ) ) {
5344
5349
  this.click();
5345
5350
  return false;
5346
5351
  }
@@ -5348,7 +5353,7 @@ jQuery.event = {
5348
5353
 
5349
5354
  // For cross-browser consistency, don't fire native .click() on links
5350
5355
  _default: function( event ) {
5351
- return jQuery.nodeName( event.target, "a" );
5356
+ return nodeName( event.target, "a" );
5352
5357
  }
5353
5358
  },
5354
5359
 
@@ -5625,11 +5630,12 @@ var
5625
5630
  rscriptTypeMasked = /^true\/(.*)/,
5626
5631
  rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;
5627
5632
 
5633
+ // Prefer a tbody over its parent table for containing new rows
5628
5634
  function manipulationTarget( elem, content ) {
5629
- if ( jQuery.nodeName( elem, "table" ) &&
5630
- jQuery.nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ) {
5635
+ if ( nodeName( elem, "table" ) &&
5636
+ nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ) {
5631
5637
 
5632
- return elem.getElementsByTagName( "tbody" )[ 0 ] || elem;
5638
+ return jQuery( ">tbody", elem )[ 0 ] || elem;
5633
5639
  }
5634
5640
 
5635
5641
  return elem;
@@ -6159,12 +6165,18 @@ var getStyles = function( elem ) {
6159
6165
 
6160
6166
  function curCSS( elem, name, computed ) {
6161
6167
  var width, minWidth, maxWidth, ret,
6168
+
6169
+ // Support: Firefox 51+
6170
+ // Retrieving style before computed somehow
6171
+ // fixes an issue with getting wrong values
6172
+ // on detached elements
6162
6173
  style = elem.style;
6163
6174
 
6164
6175
  computed = computed || getStyles( elem );
6165
6176
 
6166
- // Support: IE <=9 only
6167
- // getPropertyValue is only needed for .css('filter') (#12537)
6177
+ // getPropertyValue is needed for:
6178
+ // .css('filter') (IE 9 only, #12537)
6179
+ // .css('--customProperty) (#3144)
6168
6180
  if ( computed ) {
6169
6181
  ret = computed.getPropertyValue( name ) || computed[ name ];
6170
6182
 
@@ -6230,6 +6242,7 @@ var
6230
6242
  // except "table", "table-cell", or "table-caption"
6231
6243
  // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
6232
6244
  rdisplayswap = /^(none|table(?!-c[ea]).+)/,
6245
+ rcustomProp = /^--/,
6233
6246
  cssShow = { position: "absolute", visibility: "hidden", display: "block" },
6234
6247
  cssNormalTransform = {
6235
6248
  letterSpacing: "0",
@@ -6259,6 +6272,16 @@ function vendorPropName( name ) {
6259
6272
  }
6260
6273
  }
6261
6274
 
6275
+ // Return a property mapped along what jQuery.cssProps suggests or to
6276
+ // a vendor prefixed property.
6277
+ function finalPropName( name ) {
6278
+ var ret = jQuery.cssProps[ name ];
6279
+ if ( !ret ) {
6280
+ ret = jQuery.cssProps[ name ] = vendorPropName( name ) || name;
6281
+ }
6282
+ return ret;
6283
+ }
6284
+
6262
6285
  function setPositiveNumber( elem, value, subtract ) {
6263
6286
 
6264
6287
  // Any relative (+/-) values have already been
@@ -6319,44 +6342,31 @@ function augmentWidthOrHeight( elem, name, extra, isBorderBox, styles ) {
6319
6342
 
6320
6343
  function getWidthOrHeight( elem, name, extra ) {
6321
6344
 
6322
- // Start with offset property, which is equivalent to the border-box value
6323
- var val,
6324
- valueIsBorderBox = true,
6345
+ // Start with computed style
6346
+ var valueIsBorderBox,
6325
6347
  styles = getStyles( elem ),
6348
+ val = curCSS( elem, name, styles ),
6326
6349
  isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box";
6327
6350
 
6328
- // Support: IE <=11 only
6329
- // Running getBoundingClientRect on a disconnected node
6330
- // in IE throws an error.
6331
- if ( elem.getClientRects().length ) {
6332
- val = elem.getBoundingClientRect()[ name ];
6351
+ // Computed unit is not pixels. Stop here and return.
6352
+ if ( rnumnonpx.test( val ) ) {
6353
+ return val;
6333
6354
  }
6334
6355
 
6335
- // Some non-html elements return undefined for offsetWidth, so check for null/undefined
6336
- // svg - https://bugzilla.mozilla.org/show_bug.cgi?id=649285
6337
- // MathML - https://bugzilla.mozilla.org/show_bug.cgi?id=491668
6338
- if ( val <= 0 || val == null ) {
6339
-
6340
- // Fall back to computed then uncomputed css if necessary
6341
- val = curCSS( elem, name, styles );
6342
- if ( val < 0 || val == null ) {
6343
- val = elem.style[ name ];
6344
- }
6345
-
6346
- // Computed unit is not pixels. Stop here and return.
6347
- if ( rnumnonpx.test( val ) ) {
6348
- return val;
6349
- }
6350
-
6351
- // Check for style in case a browser which returns unreliable values
6352
- // for getComputedStyle silently falls back to the reliable elem.style
6353
- valueIsBorderBox = isBorderBox &&
6354
- ( support.boxSizingReliable() || val === elem.style[ name ] );
6356
+ // Check for style in case a browser which returns unreliable values
6357
+ // for getComputedStyle silently falls back to the reliable elem.style
6358
+ valueIsBorderBox = isBorderBox &&
6359
+ ( support.boxSizingReliable() || val === elem.style[ name ] );
6355
6360
 
6356
- // Normalize "", auto, and prepare for extra
6357
- val = parseFloat( val ) || 0;
6361
+ // Fall back to offsetWidth/Height when value is "auto"
6362
+ // 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 ) ];
6358
6365
  }
6359
6366
 
6367
+ // Normalize "", auto, and prepare for extra
6368
+ val = parseFloat( val ) || 0;
6369
+
6360
6370
  // Use the active box-sizing model to add/subtract irrelevant styles
6361
6371
  return ( val +
6362
6372
  augmentWidthOrHeight(
@@ -6420,10 +6430,15 @@ jQuery.extend( {
6420
6430
  // Make sure that we're working with the right name
6421
6431
  var ret, type, hooks,
6422
6432
  origName = jQuery.camelCase( name ),
6433
+ isCustomProp = rcustomProp.test( name ),
6423
6434
  style = elem.style;
6424
6435
 
6425
- name = jQuery.cssProps[ origName ] ||
6426
- ( jQuery.cssProps[ origName ] = vendorPropName( origName ) || origName );
6436
+ // Make sure that we're working with the right name. We don't
6437
+ // want to query the value if it is a CSS custom property
6438
+ // since they are user-defined.
6439
+ if ( !isCustomProp ) {
6440
+ name = finalPropName( origName );
6441
+ }
6427
6442
 
6428
6443
  // Gets hook for the prefixed version, then unprefixed version
6429
6444
  hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
@@ -6459,7 +6474,11 @@ jQuery.extend( {
6459
6474
  if ( !hooks || !( "set" in hooks ) ||
6460
6475
  ( value = hooks.set( elem, value, extra ) ) !== undefined ) {
6461
6476
 
6462
- style[ name ] = value;
6477
+ if ( isCustomProp ) {
6478
+ style.setProperty( name, value );
6479
+ } else {
6480
+ style[ name ] = value;
6481
+ }
6463
6482
  }
6464
6483
 
6465
6484
  } else {
@@ -6478,11 +6497,15 @@ jQuery.extend( {
6478
6497
 
6479
6498
  css: function( elem, name, extra, styles ) {
6480
6499
  var val, num, hooks,
6481
- origName = jQuery.camelCase( name );
6500
+ origName = jQuery.camelCase( name ),
6501
+ isCustomProp = rcustomProp.test( name );
6482
6502
 
6483
- // Make sure that we're working with the right name
6484
- name = jQuery.cssProps[ origName ] ||
6485
- ( jQuery.cssProps[ origName ] = vendorPropName( origName ) || origName );
6503
+ // Make sure that we're working with the right name. We don't
6504
+ // want to modify the value if it is a CSS custom property
6505
+ // since they are user-defined.
6506
+ if ( !isCustomProp ) {
6507
+ name = finalPropName( origName );
6508
+ }
6486
6509
 
6487
6510
  // Try prefixed name followed by the unprefixed name
6488
6511
  hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
@@ -6507,6 +6530,7 @@ jQuery.extend( {
6507
6530
  num = parseFloat( val );
6508
6531
  return extra === true || isFinite( num ) ? num || 0 : val;
6509
6532
  }
6533
+
6510
6534
  return val;
6511
6535
  }
6512
6536
  } );
@@ -6606,7 +6630,7 @@ jQuery.fn.extend( {
6606
6630
  map = {},
6607
6631
  i = 0;
6608
6632
 
6609
- if ( jQuery.isArray( name ) ) {
6633
+ if ( Array.isArray( name ) ) {
6610
6634
  styles = getStyles( elem );
6611
6635
  len = name.length;
6612
6636
 
@@ -6744,13 +6768,18 @@ jQuery.fx.step = {};
6744
6768
 
6745
6769
 
6746
6770
  var
6747
- fxNow, timerId,
6771
+ fxNow, inProgress,
6748
6772
  rfxtypes = /^(?:toggle|show|hide)$/,
6749
6773
  rrun = /queueHooks$/;
6750
6774
 
6751
- function raf() {
6752
- if ( timerId ) {
6753
- window.requestAnimationFrame( raf );
6775
+ function schedule() {
6776
+ if ( inProgress ) {
6777
+ if ( document.hidden === false && window.requestAnimationFrame ) {
6778
+ window.requestAnimationFrame( schedule );
6779
+ } else {
6780
+ window.setTimeout( schedule, jQuery.fx.interval );
6781
+ }
6782
+
6754
6783
  jQuery.fx.tick();
6755
6784
  }
6756
6785
  }
@@ -6977,7 +7006,7 @@ function propFilter( props, specialEasing ) {
6977
7006
  name = jQuery.camelCase( index );
6978
7007
  easing = specialEasing[ name ];
6979
7008
  value = props[ index ];
6980
- if ( jQuery.isArray( value ) ) {
7009
+ if ( Array.isArray( value ) ) {
6981
7010
  easing = value[ 1 ];
6982
7011
  value = props[ index ] = value[ 0 ];
6983
7012
  }
@@ -7036,12 +7065,19 @@ function Animation( elem, properties, options ) {
7036
7065
 
7037
7066
  deferred.notifyWith( elem, [ animation, percent, remaining ] );
7038
7067
 
7068
+ // If there's more to do, yield
7039
7069
  if ( percent < 1 && length ) {
7040
7070
  return remaining;
7041
- } else {
7042
- deferred.resolveWith( elem, [ animation ] );
7043
- return false;
7044
7071
  }
7072
+
7073
+ // If this was an empty animation, synthesize a final progress notification
7074
+ if ( !length ) {
7075
+ deferred.notifyWith( elem, [ animation, 1, 0 ] );
7076
+ }
7077
+
7078
+ // Resolve the animation and report its conclusion
7079
+ deferred.resolveWith( elem, [ animation ] );
7080
+ return false;
7045
7081
  },
7046
7082
  animation = deferred.promise( {
7047
7083
  elem: elem,
@@ -7106,6 +7142,13 @@ function Animation( elem, properties, options ) {
7106
7142
  animation.opts.start.call( elem, animation );
7107
7143
  }
7108
7144
 
7145
+ // Attach callbacks from options
7146
+ animation
7147
+ .progress( animation.opts.progress )
7148
+ .done( animation.opts.done, animation.opts.complete )
7149
+ .fail( animation.opts.fail )
7150
+ .always( animation.opts.always );
7151
+
7109
7152
  jQuery.fx.timer(
7110
7153
  jQuery.extend( tick, {
7111
7154
  elem: elem,
@@ -7114,11 +7157,7 @@ function Animation( elem, properties, options ) {
7114
7157
  } )
7115
7158
  );
7116
7159
 
7117
- // attach callbacks from options
7118
- return animation.progress( animation.opts.progress )
7119
- .done( animation.opts.done, animation.opts.complete )
7120
- .fail( animation.opts.fail )
7121
- .always( animation.opts.always );
7160
+ return animation;
7122
7161
  }
7123
7162
 
7124
7163
  jQuery.Animation = jQuery.extend( Animation, {
@@ -7169,8 +7208,8 @@ jQuery.speed = function( speed, easing, fn ) {
7169
7208
  easing: fn && easing || easing && !jQuery.isFunction( easing ) && easing
7170
7209
  };
7171
7210
 
7172
- // Go to the end state if fx are off or if document is hidden
7173
- if ( jQuery.fx.off || document.hidden ) {
7211
+ // Go to the end state if fx are off
7212
+ if ( jQuery.fx.off ) {
7174
7213
  opt.duration = 0;
7175
7214
 
7176
7215
  } else {
@@ -7362,7 +7401,7 @@ jQuery.fx.tick = function() {
7362
7401
  for ( ; i < timers.length; i++ ) {
7363
7402
  timer = timers[ i ];
7364
7403
 
7365
- // Checks the timer has not already been removed
7404
+ // Run the timer and safely remove it when done (allowing for external removal)
7366
7405
  if ( !timer() && timers[ i ] === timer ) {
7367
7406
  timers.splice( i--, 1 );
7368
7407
  }
@@ -7376,30 +7415,21 @@ jQuery.fx.tick = function() {
7376
7415
 
7377
7416
  jQuery.fx.timer = function( timer ) {
7378
7417
  jQuery.timers.push( timer );
7379
- if ( timer() ) {
7380
- jQuery.fx.start();
7381
- } else {
7382
- jQuery.timers.pop();
7383
- }
7418
+ jQuery.fx.start();
7384
7419
  };
7385
7420
 
7386
7421
  jQuery.fx.interval = 13;
7387
7422
  jQuery.fx.start = function() {
7388
- if ( !timerId ) {
7389
- timerId = window.requestAnimationFrame ?
7390
- window.requestAnimationFrame( raf ) :
7391
- window.setInterval( jQuery.fx.tick, jQuery.fx.interval );
7423
+ if ( inProgress ) {
7424
+ return;
7392
7425
  }
7426
+
7427
+ inProgress = true;
7428
+ schedule();
7393
7429
  };
7394
7430
 
7395
7431
  jQuery.fx.stop = function() {
7396
- if ( window.cancelAnimationFrame ) {
7397
- window.cancelAnimationFrame( timerId );
7398
- } else {
7399
- window.clearInterval( timerId );
7400
- }
7401
-
7402
- timerId = null;
7432
+ inProgress = null;
7403
7433
  };
7404
7434
 
7405
7435
  jQuery.fx.speeds = {
@@ -7516,7 +7546,7 @@ jQuery.extend( {
7516
7546
  type: {
7517
7547
  set: function( elem, value ) {
7518
7548
  if ( !support.radioValue && value === "radio" &&
7519
- jQuery.nodeName( elem, "input" ) ) {
7549
+ nodeName( elem, "input" ) ) {
7520
7550
  var val = elem.value;
7521
7551
  elem.setAttribute( "type", value );
7522
7552
  if ( val ) {
@@ -7947,7 +7977,7 @@ jQuery.fn.extend( {
7947
7977
  } else if ( typeof val === "number" ) {
7948
7978
  val += "";
7949
7979
 
7950
- } else if ( jQuery.isArray( val ) ) {
7980
+ } else if ( Array.isArray( val ) ) {
7951
7981
  val = jQuery.map( val, function( value ) {
7952
7982
  return value == null ? "" : value + "";
7953
7983
  } );
@@ -8006,7 +8036,7 @@ jQuery.extend( {
8006
8036
  // Don't return options that are disabled or in a disabled optgroup
8007
8037
  !option.disabled &&
8008
8038
  ( !option.parentNode.disabled ||
8009
- !jQuery.nodeName( option.parentNode, "optgroup" ) ) ) {
8039
+ !nodeName( option.parentNode, "optgroup" ) ) ) {
8010
8040
 
8011
8041
  // Get the specific value for the option
8012
8042
  value = jQuery( option ).val();
@@ -8058,7 +8088,7 @@ jQuery.extend( {
8058
8088
  jQuery.each( [ "radio", "checkbox" ], function() {
8059
8089
  jQuery.valHooks[ this ] = {
8060
8090
  set: function( elem, value ) {
8061
- if ( jQuery.isArray( value ) ) {
8091
+ if ( Array.isArray( value ) ) {
8062
8092
  return ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) > -1 );
8063
8093
  }
8064
8094
  }
@@ -8353,7 +8383,7 @@ var
8353
8383
  function buildParams( prefix, obj, traditional, add ) {
8354
8384
  var name;
8355
8385
 
8356
- if ( jQuery.isArray( obj ) ) {
8386
+ if ( Array.isArray( obj ) ) {
8357
8387
 
8358
8388
  // Serialize array item.
8359
8389
  jQuery.each( obj, function( i, v ) {
@@ -8405,7 +8435,7 @@ jQuery.param = function( a, traditional ) {
8405
8435
  };
8406
8436
 
8407
8437
  // If an array was passed in, assume that it is an array of form elements.
8408
- if ( jQuery.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
8438
+ if ( Array.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
8409
8439
 
8410
8440
  // Serialize the form elements
8411
8441
  jQuery.each( a, function() {
@@ -8451,7 +8481,7 @@ jQuery.fn.extend( {
8451
8481
  return null;
8452
8482
  }
8453
8483
 
8454
- if ( jQuery.isArray( val ) ) {
8484
+ if ( Array.isArray( val ) ) {
8455
8485
  return jQuery.map( val, function( val ) {
8456
8486
  return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
8457
8487
  } );
@@ -9876,13 +9906,6 @@ jQuery.expr.pseudos.animated = function( elem ) {
9876
9906
 
9877
9907
 
9878
9908
 
9879
- /**
9880
- * Gets a window from an element
9881
- */
9882
- function getWindow( elem ) {
9883
- return jQuery.isWindow( elem ) ? elem : elem.nodeType === 9 && elem.defaultView;
9884
- }
9885
-
9886
9909
  jQuery.offset = {
9887
9910
  setOffset: function( elem, options, i ) {
9888
9911
  var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition,
@@ -9947,13 +9970,14 @@ jQuery.fn.extend( {
9947
9970
  } );
9948
9971
  }
9949
9972
 
9950
- var docElem, win, rect, doc,
9973
+ var doc, docElem, rect, win,
9951
9974
  elem = this[ 0 ];
9952
9975
 
9953
9976
  if ( !elem ) {
9954
9977
  return;
9955
9978
  }
9956
9979
 
9980
+ // Return zeros for disconnected and hidden (display: none) elements (gh-2310)
9957
9981
  // Support: IE <=11 only
9958
9982
  // Running getBoundingClientRect on a
9959
9983
  // disconnected node in IE throws an error
@@ -9963,20 +9987,14 @@ jQuery.fn.extend( {
9963
9987
 
9964
9988
  rect = elem.getBoundingClientRect();
9965
9989
 
9966
- // Make sure element is not hidden (display: none)
9967
- if ( rect.width || rect.height ) {
9968
- doc = elem.ownerDocument;
9969
- win = getWindow( doc );
9970
- docElem = doc.documentElement;
9971
-
9972
- return {
9973
- top: rect.top + win.pageYOffset - docElem.clientTop,
9974
- left: rect.left + win.pageXOffset - docElem.clientLeft
9975
- };
9976
- }
9990
+ doc = elem.ownerDocument;
9991
+ docElem = doc.documentElement;
9992
+ win = doc.defaultView;
9977
9993
 
9978
- // Return zeros for disconnected and hidden elements (gh-2310)
9979
- return rect;
9994
+ return {
9995
+ top: rect.top + win.pageYOffset - docElem.clientTop,
9996
+ left: rect.left + win.pageXOffset - docElem.clientLeft
9997
+ };
9980
9998
  },
9981
9999
 
9982
10000
  position: function() {
@@ -10002,7 +10020,7 @@ jQuery.fn.extend( {
10002
10020
 
10003
10021
  // Get correct offsets
10004
10022
  offset = this.offset();
10005
- if ( !jQuery.nodeName( offsetParent[ 0 ], "html" ) ) {
10023
+ if ( !nodeName( offsetParent[ 0 ], "html" ) ) {
10006
10024
  parentOffset = offsetParent.offset();
10007
10025
  }
10008
10026
 
@@ -10049,7 +10067,14 @@ jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function(
10049
10067
 
10050
10068
  jQuery.fn[ method ] = function( val ) {
10051
10069
  return access( this, function( elem, method, val ) {
10052
- var win = getWindow( elem );
10070
+
10071
+ // Coalesce documents and windows
10072
+ var win;
10073
+ if ( jQuery.isWindow( elem ) ) {
10074
+ win = elem;
10075
+ } else if ( elem.nodeType === 9 ) {
10076
+ win = elem.defaultView;
10077
+ }
10053
10078
 
10054
10079
  if ( val === undefined ) {
10055
10080
  return win ? win[ prop ] : elem[ method ];
@@ -10158,7 +10183,16 @@ jQuery.fn.extend( {
10158
10183
  }
10159
10184
  } );
10160
10185
 
10186
+ jQuery.holdReady = function( hold ) {
10187
+ if ( hold ) {
10188
+ jQuery.readyWait++;
10189
+ } else {
10190
+ jQuery.ready( true );
10191
+ }
10192
+ };
10193
+ jQuery.isArray = Array.isArray;
10161
10194
  jQuery.parseJSON = JSON.parse;
10195
+ jQuery.nodeName = nodeName;
10162
10196
 
10163
10197
 
10164
10198
 
@@ -10215,6 +10249,5 @@ if ( !noGlobal ) {
10215
10249
 
10216
10250
 
10217
10251
 
10218
-
10219
10252
  return jQuery;
10220
10253
  } );