Release 3.2.0

parent f66fe427
...@@ -293,3 +293,9 @@ Damian Senn <jquery@topaxi.codes> ...@@ -293,3 +293,9 @@ Damian Senn <jquery@topaxi.codes>
Ralin Chimev <ralin.chimev@gmail.com> Ralin Chimev <ralin.chimev@gmail.com>
Felipe Sateler <fsateler@gmail.com> Felipe Sateler <fsateler@gmail.com>
Christophe Tafani-Dereeper <christophetd@hotmail.fr> Christophe Tafani-Dereeper <christophetd@hotmail.fr>
Manoj Kumar <nithmanoj@gmail.com>
David Broder-Rodgers <broder93@gmail.com>
Alex Louden <alex@louden.com>
Alex Padilla <alexonezero@outlook.com>
南漂一卒 <shiy007@qq.com>
karan-96 <karanbatra96@gmail.com>
Copyright jQuery Foundation and other contributors, https://jquery.org/ Copyright JS Foundation and other contributors, https://js.foundation/
This software consists of voluntary contributions made by many This software consists of voluntary contributions made by many
individuals. For exact contribution history, see the revision history individuals. For exact contribution history, see the revision history
......
...@@ -24,7 +24,7 @@ define( [ ...@@ -24,7 +24,7 @@ define( [
"use strict"; "use strict";
var var
version = "3.1.1", version = "3.2.0",
// Define a local copy of jQuery // Define a local copy of jQuery
jQuery = function( selector, context ) { jQuery = function( selector, context ) {
...@@ -172,11 +172,11 @@ jQuery.extend = jQuery.fn.extend = function() { ...@@ -172,11 +172,11 @@ jQuery.extend = jQuery.fn.extend = function() {
// Recurse if we're merging plain objects or arrays // Recurse if we're merging plain objects or arrays
if ( deep && copy && ( jQuery.isPlainObject( copy ) || if ( deep && copy && ( jQuery.isPlainObject( copy ) ||
( copyIsArray = jQuery.isArray( copy ) ) ) ) { ( copyIsArray = Array.isArray( copy ) ) ) ) {
if ( copyIsArray ) { if ( copyIsArray ) {
copyIsArray = false; copyIsArray = false;
clone = src && jQuery.isArray( src ) ? src : []; clone = src && Array.isArray( src ) ? src : [];
} else { } else {
clone = src && jQuery.isPlainObject( src ) ? src : {}; clone = src && jQuery.isPlainObject( src ) ? src : {};
...@@ -215,8 +215,6 @@ jQuery.extend( { ...@@ -215,8 +215,6 @@ jQuery.extend( {
return jQuery.type( obj ) === "function"; return jQuery.type( obj ) === "function";
}, },
isArray: Array.isArray,
isWindow: function( obj ) { isWindow: function( obj ) {
return obj != null && obj === obj.window; return obj != null && obj === obj.window;
}, },
...@@ -291,10 +289,6 @@ jQuery.extend( { ...@@ -291,10 +289,6 @@ jQuery.extend( {
return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase ); return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
}, },
nodeName: function( elem, name ) {
return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
},
each: function( obj, callback ) { each: function( obj, callback ) {
var length, i = 0; var length, i = 0;
......
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -2,12 +2,12 @@ ...@@ -2,12 +2,12 @@
"name": "jquery", "name": "jquery",
"title": "jQuery", "title": "jQuery",
"description": "JavaScript library for DOM operations", "description": "JavaScript library for DOM operations",
"version": "3.1.1", "version": "3.2.0",
"main": "dist/jquery.js", "main": "dist/jquery.js",
"homepage": "https://jquery.com", "homepage": "https://jquery.com",
"author": { "author": {
"name": "jQuery Foundation and other contributors", "name": "JS Foundation and other contributors",
"url": "https://github.com/jquery/jquery/blob/3.1.1/AUTHORS.txt" "url": "https://github.com/jquery/jquery/blob/3.2.0/AUTHORS.txt"
}, },
"repository": { "repository": {
"type": "git", "type": "git",
...@@ -91,7 +91,7 @@ ...@@ -91,7 +91,7 @@
"Traversing", "Traversing",
"Wrap" "Wrap"
], ],
"markerPattern": "^((clos|fix|resolv)(e[sd]|ing))|(refs?)", "markerPattern": "^((clos|fix|resolv)(e[sd]|ing))|^(refs?)",
"ticketPattern": "^((Closes|Fixes) ([a-zA-Z]{2,}-)[0-9]+)|(Refs? [^#])" "ticketPattern": "^((Closes|Fixes) ([a-zA-Z]{2,}-)[0-9]+)|^(Refs? [^#])"
} }
} }
{ {
// Support: IE <=9 only, Android <=4.0 only "root": true,
// The above browsers are failing a lot of tests in the ES5
// test suite at http://test262.ecmascript.org. "extends": "../.eslintrc-browser.json"
"parserOptions": {
"ecmaVersion": 3
},
"globals": {
"window": true,
"jQuery": true,
"define": true,
"module": true,
"noGlobal": true
},
"rules": {
"strict": ["error", "function"]
}
} }
define( [ define( [
"../core", "../core",
"../core/access", "../core/access",
"../core/nodeName",
"./support", "./support",
"../var/rnothtmlwhite", "../var/rnothtmlwhite",
"../selector" "../selector"
], function( jQuery, access, support, rnothtmlwhite ) { ], function( jQuery, access, nodeName, support, rnothtmlwhite ) {
"use strict"; "use strict";
...@@ -74,7 +75,7 @@ jQuery.extend( { ...@@ -74,7 +75,7 @@ jQuery.extend( {
type: { type: {
set: function( elem, value ) { set: function( elem, value ) {
if ( !support.radioValue && value === "radio" && if ( !support.radioValue && value === "radio" &&
jQuery.nodeName( elem, "input" ) ) { nodeName( elem, "input" ) ) {
var val = elem.value; var val = elem.value;
elem.setAttribute( "type", value ); elem.setAttribute( "type", value );
if ( val ) { if ( val ) {
......
...@@ -2,8 +2,10 @@ define( [ ...@@ -2,8 +2,10 @@ define( [
"../core", "../core",
"../core/stripAndCollapse", "../core/stripAndCollapse",
"./support", "./support",
"../core/nodeName",
"../core/init" "../core/init"
], function( jQuery, stripAndCollapse, support ) { ], function( jQuery, stripAndCollapse, support, nodeName ) {
"use strict"; "use strict";
...@@ -62,7 +64,7 @@ jQuery.fn.extend( { ...@@ -62,7 +64,7 @@ jQuery.fn.extend( {
} else if ( typeof val === "number" ) { } else if ( typeof val === "number" ) {
val += ""; val += "";
} else if ( jQuery.isArray( val ) ) { } else if ( Array.isArray( val ) ) {
val = jQuery.map( val, function( value ) { val = jQuery.map( val, function( value ) {
return value == null ? "" : value + ""; return value == null ? "" : value + "";
} ); } );
...@@ -121,7 +123,7 @@ jQuery.extend( { ...@@ -121,7 +123,7 @@ jQuery.extend( {
// Don't return options that are disabled or in a disabled optgroup // Don't return options that are disabled or in a disabled optgroup
!option.disabled && !option.disabled &&
( !option.parentNode.disabled || ( !option.parentNode.disabled ||
!jQuery.nodeName( option.parentNode, "optgroup" ) ) ) { !nodeName( option.parentNode, "optgroup" ) ) ) {
// Get the specific value for the option // Get the specific value for the option
value = jQuery( option ).val(); value = jQuery( option ).val();
...@@ -173,7 +175,7 @@ jQuery.extend( { ...@@ -173,7 +175,7 @@ jQuery.extend( {
jQuery.each( [ "radio", "checkbox" ], function() { jQuery.each( [ "radio", "checkbox" ], function() {
jQuery.valHooks[ this ] = { jQuery.valHooks[ this ] = {
set: function( elem, value ) { set: function( elem, value ) {
if ( jQuery.isArray( value ) ) { if ( Array.isArray( value ) ) {
return ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) > -1 ); return ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) > -1 );
} }
} }
......
...@@ -69,7 +69,7 @@ jQuery.Callbacks = function( options ) { ...@@ -69,7 +69,7 @@ jQuery.Callbacks = function( options ) {
fire = function() { fire = function() {
// Enforce single-firing // Enforce single-firing
locked = options.once; locked = locked || options.once;
// Execute callbacks for all pending executions, // Execute callbacks for all pending executions,
// respecting firingIndex overrides and runtime changes // respecting firingIndex overrides and runtime changes
......
...@@ -24,7 +24,7 @@ define( [ ...@@ -24,7 +24,7 @@ define( [
"use strict"; "use strict";
var var
version = "3.1.1", version = "3.2.0",
// Define a local copy of jQuery // Define a local copy of jQuery
jQuery = function( selector, context ) { jQuery = function( selector, context ) {
...@@ -172,11 +172,11 @@ jQuery.extend = jQuery.fn.extend = function() { ...@@ -172,11 +172,11 @@ jQuery.extend = jQuery.fn.extend = function() {
// Recurse if we're merging plain objects or arrays // Recurse if we're merging plain objects or arrays
if ( deep && copy && ( jQuery.isPlainObject( copy ) || if ( deep && copy && ( jQuery.isPlainObject( copy ) ||
( copyIsArray = jQuery.isArray( copy ) ) ) ) { ( copyIsArray = Array.isArray( copy ) ) ) ) {
if ( copyIsArray ) { if ( copyIsArray ) {
copyIsArray = false; copyIsArray = false;
clone = src && jQuery.isArray( src ) ? src : []; clone = src && Array.isArray( src ) ? src : [];
} else { } else {
clone = src && jQuery.isPlainObject( src ) ? src : {}; clone = src && jQuery.isPlainObject( src ) ? src : {};
...@@ -215,8 +215,6 @@ jQuery.extend( { ...@@ -215,8 +215,6 @@ jQuery.extend( {
return jQuery.type( obj ) === "function"; return jQuery.type( obj ) === "function";
}, },
isArray: Array.isArray,
isWindow: function( obj ) { isWindow: function( obj ) {
return obj != null && obj === obj.window; return obj != null && obj === obj.window;
}, },
...@@ -291,10 +289,6 @@ jQuery.extend( { ...@@ -291,10 +289,6 @@ jQuery.extend( {
return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase ); return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
}, },
nodeName: function( elem, name ) {
return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
},
each: function( obj, callback ) { each: function( obj, callback ) {
var length, i = 0; var length, i = 0;
......
...@@ -3,6 +3,7 @@ define( [ ...@@ -3,6 +3,7 @@ define( [
"../core", "../core",
"../var/document", "../var/document",
"./var/rsingleTag", "./var/rsingleTag",
"../traversing/findFilter" "../traversing/findFilter"
], function( jQuery, document, rsingleTag ) { ], function( jQuery, document, rsingleTag ) {
......
define( function() {
"use strict";
function nodeName( elem, name ) {
return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
};
return nodeName;
} );
...@@ -32,15 +32,6 @@ jQuery.extend( { ...@@ -32,15 +32,6 @@ jQuery.extend( {
// the ready event fires. See #6781 // the ready event fires. See #6781
readyWait: 1, readyWait: 1,
// Hold (or release) the ready event
holdReady: function( hold ) {
if ( hold ) {
jQuery.readyWait++;
} else {
jQuery.ready( true );
}
},
ready: function( wait ) { ready: function( wait ) {
// Abort if there are pending holds or we're already ready // Abort if there are pending holds or we're already ready
......
...@@ -34,15 +34,6 @@ jQuery.extend( { ...@@ -34,15 +34,6 @@ jQuery.extend( {
// the ready event fires. See #6781 // the ready event fires. See #6781
readyWait: 1, readyWait: 1,
// Hold (or release) the ready event
holdReady: function( hold ) {
if ( hold ) {
jQuery.readyWait++;
} else {
jQuery.ready( true );
}
},
// Handle when the DOM is ready // Handle when the DOM is ready
ready: function( wait ) { ready: function( wait ) {
......
...@@ -28,6 +28,7 @@ var ...@@ -28,6 +28,7 @@ var
// except "table", "table-cell", or "table-caption" // except "table", "table-cell", or "table-caption"
// See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
rdisplayswap = /^(none|table(?!-c[ea]).+)/, rdisplayswap = /^(none|table(?!-c[ea]).+)/,
rcustomProp = /^--/,
cssShow = { position: "absolute", visibility: "hidden", display: "block" }, cssShow = { position: "absolute", visibility: "hidden", display: "block" },
cssNormalTransform = { cssNormalTransform = {
letterSpacing: "0", letterSpacing: "0",
...@@ -57,6 +58,16 @@ function vendorPropName( name ) { ...@@ -57,6 +58,16 @@ function vendorPropName( name ) {
} }
} }
// Return a property mapped along what jQuery.cssProps suggests or to
// a vendor prefixed property.
function finalPropName( name ) {
var ret = jQuery.cssProps[ name ];
if ( !ret ) {
ret = jQuery.cssProps[ name ] = vendorPropName( name ) || name;
}
return ret;
}
function setPositiveNumber( elem, value, subtract ) { function setPositiveNumber( elem, value, subtract ) {
// Any relative (+/-) values have already been // Any relative (+/-) values have already been
...@@ -117,43 +128,24 @@ function augmentWidthOrHeight( elem, name, extra, isBorderBox, styles ) { ...@@ -117,43 +128,24 @@ function augmentWidthOrHeight( elem, name, extra, isBorderBox, styles ) {
function getWidthOrHeight( elem, name, extra ) { function getWidthOrHeight( elem, name, extra ) {
// Start with offset property, which is equivalent to the border-box value // Start with computed style
var val, var valueIsBorderBox,
valueIsBorderBox = true,
styles = getStyles( elem ), styles = getStyles( elem ),
val = curCSS( elem, name, styles ),
isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box"; isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box";
// Support: IE <=11 only // Computed unit is not pixels. Stop here and return.
// Running getBoundingClientRect on a disconnected node if ( rnumnonpx.test( val ) ) {
// in IE throws an error. return val;
if ( elem.getClientRects().length ) {
val = elem.getBoundingClientRect()[ name ];
} }
// Some non-html elements return undefined for offsetWidth, so check for null/undefined // Check for style in case a browser which returns unreliable values
// svg - https://bugzilla.mozilla.org/show_bug.cgi?id=649285 // for getComputedStyle silently falls back to the reliable elem.style
// MathML - https://bugzilla.mozilla.org/show_bug.cgi?id=491668 valueIsBorderBox = isBorderBox &&
if ( val <= 0 || val == null ) { ( support.boxSizingReliable() || val === elem.style[ name ] );
// Fall back to computed then uncomputed css if necessary
val = curCSS( elem, name, styles );
if ( val < 0 || val == null ) {
val = elem.style[ name ];
}
// Computed unit is not pixels. Stop here and return.
if ( rnumnonpx.test( val ) ) {
return val;
}
// Check for style in case a browser which returns unreliable values
// for getComputedStyle silently falls back to the reliable elem.style
valueIsBorderBox = isBorderBox &&
( support.boxSizingReliable() || val === elem.style[ name ] );
// Normalize "", auto, and prepare for extra // Normalize "", auto, and prepare for extra
val = parseFloat( val ) || 0; val = parseFloat( val ) || 0;
}
// Use the active box-sizing model to add/subtract irrelevant styles // Use the active box-sizing model to add/subtract irrelevant styles
return ( val + return ( val +
...@@ -218,10 +210,15 @@ jQuery.extend( { ...@@ -218,10 +210,15 @@ jQuery.extend( {
// Make sure that we're working with the right name // Make sure that we're working with the right name
var ret, type, hooks, var ret, type, hooks,
origName = jQuery.camelCase( name ), origName = jQuery.camelCase( name ),
isCustomProp = rcustomProp.test( name ),
style = elem.style; style = elem.style;
name = jQuery.cssProps[ origName ] || // Make sure that we're working with the right name. We don't
( jQuery.cssProps[ origName ] = vendorPropName( origName ) || origName ); // want to query the value if it is a CSS custom property
// since they are user-defined.
if ( !isCustomProp ) {
name = finalPropName( origName );
}
// Gets hook for the prefixed version, then unprefixed version // Gets hook for the prefixed version, then unprefixed version
hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
...@@ -257,7 +254,11 @@ jQuery.extend( { ...@@ -257,7 +254,11 @@ jQuery.extend( {
if ( !hooks || !( "set" in hooks ) || if ( !hooks || !( "set" in hooks ) ||
( value = hooks.set( elem, value, extra ) ) !== undefined ) { ( value = hooks.set( elem, value, extra ) ) !== undefined ) {
style[ name ] = value; if ( isCustomProp ) {
style.setProperty( name, value );
} else {
style[ name ] = value;
}
} }
} else { } else {
...@@ -276,11 +277,15 @@ jQuery.extend( { ...@@ -276,11 +277,15 @@ jQuery.extend( {
css: function( elem, name, extra, styles ) { css: function( elem, name, extra, styles ) {
var val, num, hooks, var val, num, hooks,
origName = jQuery.camelCase( name ); origName = jQuery.camelCase( name ),
isCustomProp = rcustomProp.test( name );
// Make sure that we're working with the right name // Make sure that we're working with the right name. We don't
name = jQuery.cssProps[ origName ] || // want to modify the value if it is a CSS custom property
( jQuery.cssProps[ origName ] = vendorPropName( origName ) || origName ); // since they are user-defined.
if ( !isCustomProp ) {
name = finalPropName( origName );
}
// Try prefixed name followed by the unprefixed name // Try prefixed name followed by the unprefixed name
hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
...@@ -305,6 +310,7 @@ jQuery.extend( { ...@@ -305,6 +310,7 @@ jQuery.extend( {
num = parseFloat( val ); num = parseFloat( val );
return extra === true || isFinite( num ) ? num || 0 : val; return extra === true || isFinite( num ) ? num || 0 : val;
} }
return val; return val;
} }
} ); } );
...@@ -404,7 +410,7 @@ jQuery.fn.extend( { ...@@ -404,7 +410,7 @@ jQuery.fn.extend( {
map = {}, map = {},
i = 0; i = 0;
if ( jQuery.isArray( name ) ) { if ( Array.isArray( name ) ) {
styles = getStyles( elem ); styles = getStyles( elem );
len = name.length; len = name.length;
......
...@@ -15,8 +15,9 @@ function curCSS( elem, name, computed ) { ...@@ -15,8 +15,9 @@ function curCSS( elem, name, computed ) {
computed = computed || getStyles( elem ); computed = computed || getStyles( elem );
// Support: IE <=9 only // getPropertyValue is needed for:
// getPropertyValue is only needed for .css('filter') (#12537) // .css('filter') (IE 9 only, #12537)
// .css('--customProperty) (#3144)
if ( computed ) { if ( computed ) {
ret = computed.getPropertyValue( name ) || computed[ name ]; ret = computed.getPropertyValue( name ) || computed[ name ];
......
...@@ -115,7 +115,7 @@ Data.prototype = { ...@@ -115,7 +115,7 @@ Data.prototype = {
if ( key !== undefined ) { if ( key !== undefined ) {
// Support array or space separated string of keys // Support array or space separated string of keys
if ( jQuery.isArray( key ) ) { if ( Array.isArray( key ) ) {
// If key is an array of keys... // If key is an array of keys...
// We always set camelCase keys, so remove that. // We always set camelCase keys, so remove that.
......
...@@ -13,7 +13,7 @@ function Thrower( ex ) { ...@@ -13,7 +13,7 @@ function Thrower( ex ) {
throw ex; throw ex;
} }
function adoptValue( value, resolve, reject ) { function adoptValue( value, resolve, reject, noValue ) {
var method; var method;
try { try {
...@@ -29,9 +29,10 @@ function adoptValue( value, resolve, reject ) { ...@@ -29,9 +29,10 @@ function adoptValue( value, resolve, reject ) {
// Other non-thenables // Other non-thenables
} else { } else {
// Support: Android 4.0 only // Control `resolve` arguments by letting Array#slice cast boolean `noValue` to integer:
// Strict mode functions invoked without .call/.apply get global-object context // * false: [ value ].slice( 0 ) => resolve( value )
resolve.call( undefined, value ); // * true: [ value ].slice( 1 ) => resolve()
resolve.apply( undefined, [ value ].slice( noValue ) );
} }
// For Promises/A+, convert exceptions into rejections // For Promises/A+, convert exceptions into rejections
...@@ -41,7 +42,7 @@ function adoptValue( value, resolve, reject ) { ...@@ -41,7 +42,7 @@ function adoptValue( value, resolve, reject ) {
// Support: Android 4.0 only // Support: Android 4.0 only
// Strict mode functions invoked without .call/.apply get global-object context // Strict mode functions invoked without .call/.apply get global-object context
reject.call( undefined, value ); reject.apply( undefined, [ value ] );
} }
} }
...@@ -366,7 +367,8 @@ jQuery.extend( { ...@@ -366,7 +367,8 @@ jQuery.extend( {
// Single- and empty arguments are adopted like Promise.resolve // Single- and empty arguments are adopted like Promise.resolve
if ( remaining <= 1 ) { if ( remaining <= 1 ) {
adoptValue( singleValue, master.done( updateFunc( i ) ).resolve, master.reject ); adoptValue( singleValue, master.done( updateFunc( i ) ).resolve, master.reject,
!remaining );
// Use .then() to unwrap secondary thenables (cf. gh-3000) // Use .then() to unwrap secondary thenables (cf. gh-3000)
if ( master.state() === "pending" || if ( master.state() === "pending" ||
......
define( [ define( [
"./core" "./core",
], function( jQuery ) { "./core/nodeName"
], function( jQuery, nodeName ) {
"use strict"; "use strict";
...@@ -22,9 +23,18 @@ jQuery.fn.extend( { ...@@ -22,9 +23,18 @@ jQuery.fn.extend( {
return arguments.length === 1 ? return arguments.length === 1 ?
this.off( selector, "**" ) : this.off( selector, "**" ) :
this.off( types, selector || "**", fn ); this.off( types, selector || "**", fn );
},
holdReady: function( hold ) {
if ( hold ) {
jQuery.readyWait++;
} else {
jQuery.ready( true );
}
} }
} ); } );
jQuery.isArray = Array.isArray;
jQuery.parseJSON = JSON.parse; jQuery.parseJSON = JSON.parse;
jQuery.nodeName = nodeName;
} ); } );
...@@ -23,13 +23,18 @@ define( [ ...@@ -23,13 +23,18 @@ define( [
"use strict"; "use strict";
var var
fxNow, timerId, fxNow, inProgress,
rfxtypes = /^(?:toggle|show|hide)$/, rfxtypes = /^(?:toggle|show|hide)$/,
rrun = /queueHooks$/; rrun = /queueHooks$/;
function raf() { function schedule() {
if ( timerId ) { if ( inProgress ) {
window.requestAnimationFrame( raf ); if ( document.hidden === false && window.requestAnimationFrame ) {
window.requestAnimationFrame( schedule );
} else {
window.setTimeout( schedule, jQuery.fx.interval );
}
jQuery.fx.tick(); jQuery.fx.tick();
} }
} }
...@@ -256,7 +261,7 @@ function propFilter( props, specialEasing ) { ...@@ -256,7 +261,7 @@ function propFilter( props, specialEasing ) {
name = jQuery.camelCase( index ); name = jQuery.camelCase( index );
easing = specialEasing[ name ]; easing = specialEasing[ name ];
value = props[ index ]; value = props[ index ];
if ( jQuery.isArray( value ) ) { if ( Array.isArray( value ) ) {
easing = value[ 1 ]; easing = value[ 1 ];
value = props[ index ] = value[ 0 ]; value = props[ index ] = value[ 0 ];
} }
...@@ -315,12 +320,19 @@ function Animation( elem, properties, options ) { ...@@ -315,12 +320,19 @@ function Animation( elem, properties, options ) {
deferred.notifyWith( elem, [ animation, percent, remaining ] ); deferred.notifyWith( elem, [ animation, percent, remaining ] );
// If there's more to do, yield
if ( percent < 1 && length ) { if ( percent < 1 && length ) {
return remaining; return remaining;
} else {
deferred.resolveWith( elem, [ animation ] );
return false;
} }
// If this was an empty animation, synthesize a final progress notification
if ( !length ) {
deferred.notifyWith( elem, [ animation, 1, 0 ] );
}
// Resolve the animation and report its conclusion
deferred.resolveWith( elem, [ animation ] );
return false;
}, },
animation = deferred.promise( { animation = deferred.promise( {
elem: elem, elem: elem,
...@@ -385,6 +397,13 @@ function Animation( elem, properties, options ) { ...@@ -385,6 +397,13 @@ function Animation( elem, properties, options ) {
animation.opts.start.call( elem, animation ); animation.opts.start.call( elem, animation );
} }
// Attach callbacks from options
animation
.progress( animation.opts.progress )
.done( animation.opts.done, animation.opts.complete )
.fail( animation.opts.fail )
.always( animation.opts.always );
jQuery.fx.timer( jQuery.fx.timer(
jQuery.extend( tick, { jQuery.extend( tick, {
elem: elem, elem: elem,
...@@ -393,11 +412,7 @@ function Animation( elem, properties, options ) { ...@@ -393,11 +412,7 @@ function Animation( elem, properties, options ) {
} ) } )
); );
// attach callbacks from options return animation;
return animation.progress( animation.opts.progress )
.done( animation.opts.done, animation.opts.complete )
.fail( animation.opts.fail )
.always( animation.opts.always );
} }
jQuery.Animation = jQuery.extend( Animation, { jQuery.Animation = jQuery.extend( Animation, {
...@@ -448,8 +463,8 @@ jQuery.speed = function( speed, easing, fn ) { ...@@ -448,8 +463,8 @@ jQuery.speed = function( speed, easing, fn ) {
easing: fn && easing || easing && !jQuery.isFunction( easing ) && easing easing: fn && easing || easing && !jQuery.isFunction( easing ) && easing
}; };
// Go to the end state if fx are off or if document is hidden // Go to the end state if fx are off
if ( jQuery.fx.off || document.hidden ) { if ( jQuery.fx.off ) {
opt.duration = 0; opt.duration = 0;
} else { } else {
...@@ -641,7 +656,7 @@ jQuery.fx.tick = function() { ...@@ -641,7 +656,7 @@ jQuery.fx.tick = function() {
for ( ; i < timers.length; i++ ) { for ( ; i < timers.length; i++ ) {
timer = timers[ i ]; timer = timers[ i ];
// Checks the timer has not already been removed // Run the timer and safely remove it when done (allowing for external removal)
if ( !timer() && timers[ i ] === timer ) { if ( !timer() && timers[ i ] === timer ) {
timers.splice( i--, 1 ); timers.splice( i--, 1 );
} }
...@@ -655,30 +670,21 @@ jQuery.fx.tick = function() { ...@@ -655,30 +670,21 @@ jQuery.fx.tick = function() {
jQuery.fx.timer = function( timer ) { jQuery.fx.timer = function( timer ) {
jQuery.timers.push( timer ); jQuery.timers.push( timer );
if ( timer() ) { jQuery.fx.start();
jQuery.fx.start();
} else {
jQuery.timers.pop();
}
}; };
jQuery.fx.interval = 13; jQuery.fx.interval = 13;
jQuery.fx.start = function() { jQuery.fx.start = function() {
if ( !timerId ) { if ( inProgress ) {
timerId = window.requestAnimationFrame ? return;
window.requestAnimationFrame( raf ) :
window.setInterval( jQuery.fx.tick, jQuery.fx.interval );
} }
inProgress = true;
schedule();
}; };
jQuery.fx.stop = function() { jQuery.fx.stop = function() {
if ( window.cancelAnimationFrame ) { inProgress = null;
window.cancelAnimationFrame( timerId );
} else {
window.clearInterval( timerId );
}
timerId = null;
}; };
jQuery.fx.speeds = { jQuery.fx.speeds = {
......
...@@ -3,12 +3,15 @@ define( [ ...@@ -3,12 +3,15 @@ define( [
"./var/document", "./var/document",
"./var/documentElement", "./var/documentElement",
"./var/rnothtmlwhite", "./var/rnothtmlwhite",
"./var/rcheckableType",
"./var/slice", "./var/slice",
"./data/var/dataPriv", "./data/var/dataPriv",
"./core/nodeName",
"./core/init", "./core/init",
"./selector" "./selector"
], function( jQuery, document, documentElement, rnothtmlwhite, slice, dataPriv ) { ], function( jQuery, document, documentElement, rnothtmlwhite,
rcheckableType, slice, dataPriv, nodeName ) {
"use strict"; "use strict";
...@@ -474,9 +477,11 @@ jQuery.event = { ...@@ -474,9 +477,11 @@ jQuery.event = {
}, },
click: { click: {
// For checkbox, fire native event so checked state will be right // For checkable types, fire native event so checked state will be right
trigger: function() { trigger: function() {
if ( this.type === "checkbox" && this.click && jQuery.nodeName( this, "input" ) ) { if ( rcheckableType.test( this.type ) &&
this.click && nodeName( this, "input" ) ) {
this.click(); this.click();
return false; return false;
} }
...@@ -484,7 +489,7 @@ jQuery.event = { ...@@ -484,7 +489,7 @@ jQuery.event = {
// For cross-browser consistency, don't fire native .click() on links // For cross-browser consistency, don't fire native .click() on links
_default: function( event ) { _default: function( event ) {
return jQuery.nodeName( event.target, "a" ); return nodeName( event.target, "a" );
} }
}, },
......
...@@ -2,8 +2,8 @@ define( [ ...@@ -2,8 +2,8 @@ define( [
"./core", "./core",
"./var/concat", "./var/concat",
"./var/push", "./var/push",
"./var/rcheckableType",
"./core/access", "./core/access",
"./manipulation/var/rcheckableType",
"./manipulation/var/rtagName", "./manipulation/var/rtagName",
"./manipulation/var/rscriptType", "./manipulation/var/rscriptType",
"./manipulation/wrapMap", "./manipulation/wrapMap",
...@@ -16,15 +16,16 @@ define( [ ...@@ -16,15 +16,16 @@ define( [
"./data/var/dataUser", "./data/var/dataUser",
"./data/var/acceptData", "./data/var/acceptData",
"./core/DOMEval", "./core/DOMEval",
"./core/nodeName",
"./core/init", "./core/init",
"./traversing", "./traversing",
"./selector", "./selector",
"./event" "./event"
], function( jQuery, concat, push, access, ], function( jQuery, concat, push, rcheckableType,
rcheckableType, rtagName, rscriptType, access, rtagName, rscriptType,
wrapMap, getAll, setGlobalEval, buildFragment, support, wrapMap, getAll, setGlobalEval, buildFragment, support,
dataPriv, dataUser, acceptData, DOMEval ) { dataPriv, dataUser, acceptData, DOMEval, nodeName ) {
"use strict"; "use strict";
...@@ -47,11 +48,12 @@ var ...@@ -47,11 +48,12 @@ var
rscriptTypeMasked = /^true\/(.*)/, rscriptTypeMasked = /^true\/(.*)/,
rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g; rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;
// Prefer a tbody over its parent table for containing new rows
function manipulationTarget( elem, content ) { function manipulationTarget( elem, content ) {
if ( jQuery.nodeName( elem, "table" ) && if ( nodeName( elem, "table" ) &&
jQuery.nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ) { nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ) {
return elem.getElementsByTagName( "tbody" )[ 0 ] || elem; return jQuery( ">tbody", elem )[ 0 ] || elem;
} }
return elem; return elem;
......
define( [ define( [
"../core" "../core",
], function( jQuery ) { "../core/nodeName"
], function( jQuery, nodeName ) {
"use strict"; "use strict";
...@@ -20,7 +21,7 @@ function getAll( context, tag ) { ...@@ -20,7 +21,7 @@ function getAll( context, tag ) {
ret = []; ret = [];
} }
if ( tag === undefined || tag && jQuery.nodeName( context, tag ) ) { if ( tag === undefined || tag && nodeName( context, tag ) ) {
return jQuery.merge( [ context ], ret ); return jQuery.merge( [ context ], ret );
} }
......
...@@ -7,21 +7,16 @@ define( [ ...@@ -7,21 +7,16 @@ define( [
"./css/curCSS", "./css/curCSS",
"./css/addGetHookIf", "./css/addGetHookIf",
"./css/support", "./css/support",
"./core/nodeName",
"./core/init", "./core/init",
"./css", "./css",
"./selector" // contains "./selector" // contains
], function( jQuery, access, document, documentElement, rnumnonpx, curCSS, addGetHookIf, support ) { ], function( jQuery, access, document, documentElement, rnumnonpx,
curCSS, addGetHookIf, support, nodeName ) {
"use strict"; "use strict";
/**
* Gets a window from an element
*/
function getWindow( elem ) {
return jQuery.isWindow( elem ) ? elem : elem.nodeType === 9 && elem.defaultView;
}
jQuery.offset = { jQuery.offset = {
setOffset: function( elem, options, i ) { setOffset: function( elem, options, i ) {
var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition, var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition,
...@@ -86,13 +81,14 @@ jQuery.fn.extend( { ...@@ -86,13 +81,14 @@ jQuery.fn.extend( {
} ); } );
} }
var docElem, win, rect, doc, var doc, docElem, rect, win,
elem = this[ 0 ]; elem = this[ 0 ];
if ( !elem ) { if ( !elem ) {
return; return;
} }
// Return zeros for disconnected and hidden (display: none) elements (gh-2310)
// Support: IE <=11 only // Support: IE <=11 only
// Running getBoundingClientRect on a // Running getBoundingClientRect on a
// disconnected node in IE throws an error // disconnected node in IE throws an error
...@@ -102,20 +98,14 @@ jQuery.fn.extend( { ...@@ -102,20 +98,14 @@ jQuery.fn.extend( {
rect = elem.getBoundingClientRect(); rect = elem.getBoundingClientRect();
// Make sure element is not hidden (display: none) doc = elem.ownerDocument;
if ( rect.width || rect.height ) { docElem = doc.documentElement;
doc = elem.ownerDocument; win = doc.defaultView;
win = getWindow( doc );
docElem = doc.documentElement;
return {
top: rect.top + win.pageYOffset - docElem.clientTop,
left: rect.left + win.pageXOffset - docElem.clientLeft
};
}
// Return zeros for disconnected and hidden elements (gh-2310) return {
return rect; top: rect.top + win.pageYOffset - docElem.clientTop,
left: rect.left + win.pageXOffset - docElem.clientLeft
};
}, },
position: function() { position: function() {
...@@ -141,7 +131,7 @@ jQuery.fn.extend( { ...@@ -141,7 +131,7 @@ jQuery.fn.extend( {
// Get correct offsets // Get correct offsets
offset = this.offset(); offset = this.offset();
if ( !jQuery.nodeName( offsetParent[ 0 ], "html" ) ) { if ( !nodeName( offsetParent[ 0 ], "html" ) ) {
parentOffset = offsetParent.offset(); parentOffset = offsetParent.offset();
} }
...@@ -188,7 +178,14 @@ jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( ...@@ -188,7 +178,14 @@ jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function(
jQuery.fn[ method ] = function( val ) { jQuery.fn[ method ] = function( val ) {
return access( this, function( elem, method, val ) { return access( this, function( elem, method, val ) {
var win = getWindow( elem );
// Coalesce documents and windows
var win;
if ( jQuery.isWindow( elem ) ) {
win = elem;
} else if ( elem.nodeType === 9 ) {
win = elem.defaultView;
}
if ( val === undefined ) { if ( val === undefined ) {
return win ? win[ prop ] : elem[ method ]; return win ? win[ prop ] : elem[ method ];
......
...@@ -17,7 +17,7 @@ jQuery.extend( { ...@@ -17,7 +17,7 @@ jQuery.extend( {
// Speed up dequeue by getting out quickly if this is just a lookup // Speed up dequeue by getting out quickly if this is just a lookup
if ( data ) { if ( data ) {
if ( !queue || jQuery.isArray( data ) ) { if ( !queue || Array.isArray( data ) ) {
queue = dataPriv.access( elem, type, jQuery.makeArray( data ) ); queue = dataPriv.access( elem, type, jQuery.makeArray( data ) );
} else { } else {
queue.push( data ); queue.push( data );
......
define( [ define( [
"./core", "./core",
"./manipulation/var/rcheckableType", "./var/rcheckableType",
"./core/init", "./core/init",
"./traversing", // filter "./traversing", // filter
"./attributes/prop" "./attributes/prop"
...@@ -17,7 +17,7 @@ var ...@@ -17,7 +17,7 @@ var
function buildParams( prefix, obj, traditional, add ) { function buildParams( prefix, obj, traditional, add ) {
var name; var name;
if ( jQuery.isArray( obj ) ) { if ( Array.isArray( obj ) ) {
// Serialize array item. // Serialize array item.
jQuery.each( obj, function( i, v ) { jQuery.each( obj, function( i, v ) {
...@@ -69,7 +69,7 @@ jQuery.param = function( a, traditional ) { ...@@ -69,7 +69,7 @@ jQuery.param = function( a, traditional ) {
}; };
// If an array was passed in, assume that it is an array of form elements. // If an array was passed in, assume that it is an array of form elements.
if ( jQuery.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) { if ( Array.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
// Serialize the form elements // Serialize the form elements
jQuery.each( a, function() { jQuery.each( a, function() {
...@@ -115,7 +115,7 @@ jQuery.fn.extend( { ...@@ -115,7 +115,7 @@ jQuery.fn.extend( {
return null; return null;
} }
if ( jQuery.isArray( val ) ) { if ( Array.isArray( val ) ) {
return jQuery.map( val, function( val ) { return jQuery.map( val, function( val ) {
return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
} ); } );
......
...@@ -4,10 +4,12 @@ define( [ ...@@ -4,10 +4,12 @@ define( [
"./traversing/var/dir", "./traversing/var/dir",
"./traversing/var/siblings", "./traversing/var/siblings",
"./traversing/var/rneedsContext", "./traversing/var/rneedsContext",
"./core/nodeName",
"./core/init", "./core/init",
"./traversing/findFilter", "./traversing/findFilter",
"./selector" "./selector"
], function( jQuery, indexOf, dir, siblings, rneedsContext ) { ], function( jQuery, indexOf, dir, siblings, rneedsContext, nodeName ) {
"use strict"; "use strict";
...@@ -143,7 +145,18 @@ jQuery.each( { ...@@ -143,7 +145,18 @@ jQuery.each( {
return siblings( elem.firstChild ); return siblings( elem.firstChild );
}, },
contents: function( elem ) { contents: function( elem ) {
return elem.contentDocument || jQuery.merge( [], elem.childNodes ); if ( nodeName( elem, "iframe" ) ) {
return elem.contentDocument;
}
// Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only
// Treat the template element as a regular one in browsers that
// don't support it.
if ( nodeName( elem, "template" ) ) {
elem = elem.content || elem;
}
return jQuery.merge( [], elem.childNodes );
} }
}, function( name, fn ) { }, function( name, fn ) {
jQuery.fn[ name ] = function( until, selector ) { jQuery.fn[ name ] = function( until, selector ) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment