Release 3.3.0

parent 77d2a51d
...@@ -184,7 +184,7 @@ Karl Sieburg <ksieburg@yahoo.com> ...@@ -184,7 +184,7 @@ Karl Sieburg <ksieburg@yahoo.com>
Pascal Borreli <pascal@borreli.com> Pascal Borreli <pascal@borreli.com>
Nguyen Phuc Lam <ruado1987@gmail.com> Nguyen Phuc Lam <ruado1987@gmail.com>
Dmitry Gusev <dmitry.gusev@gmail.com> Dmitry Gusev <dmitry.gusev@gmail.com>
Michał Gołębiowski <m.goleb@gmail.com> Michał Gołębiowski-Owczarek <m.goleb@gmail.com>
Li Xudong <istonelee@gmail.com> Li Xudong <istonelee@gmail.com>
Steven Benner <admin@stevenbenner.com> Steven Benner <admin@stevenbenner.com>
Tom H Fuertes <tomfuertes@gmail.com> Tom H Fuertes <tomfuertes@gmail.com>
...@@ -299,3 +299,15 @@ Alex Louden <alex@louden.com> ...@@ -299,3 +299,15 @@ Alex Louden <alex@louden.com>
Alex Padilla <alexonezero@outlook.com> Alex Padilla <alexonezero@outlook.com>
南漂一卒 <shiy007@qq.com> 南漂一卒 <shiy007@qq.com>
karan-96 <karanbatra96@gmail.com> karan-96 <karanbatra96@gmail.com>
Boom Lee <teabyii@gmail.com>
Andreas Solleder <asol@num42.de>
CDAGaming <cstack2011@yahoo.com>
Pierre Spring <pierre@nelm.io>
Shashanka Nataraj <shashankan.10@gmail.com>
Erik Lax <erik@datahack.se>
Matan Kotler-Berkowitz <205matan@gmail.com>
Jordan Beland <jordan.beland@gmail.com>
Henry Zhu <hi@henryzoo.com>
Saptak Sengupta <saptak013@gmail.com>
Nilton Cesar <niltoncms@gmail.com>
basil.belokon <basil.belokon@gmail.com>
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
For information on how to get started and how to use jQuery, please see [jQuery's documentation](http://api.jquery.com/). For information on how to get started and how to use jQuery, please see [jQuery's documentation](http://api.jquery.com/).
For source files and issues, please visit the [jQuery repo](https://github.com/jquery/jquery). For source files and issues, please visit the [jQuery repo](https://github.com/jquery/jquery).
If upgrading, please see the [blog post for 3.2.1](https://blog.jquery.com/2017/03/20/jquery-3-2-1-now-available/). This includes notable differences from the previous version and a more readable changelog. If upgrading, please see the [blog post for 3.3.0](https://blog.jquery.com/2017/03/20/jquery-3.3.0-now-available/). This includes notable differences from the previous version and a more readable changelog.
## Including jQuery ## Including jQuery
...@@ -16,7 +16,7 @@ Below are some of the most common ways to include jQuery. ...@@ -16,7 +16,7 @@ Below are some of the most common ways to include jQuery.
#### Script tag #### Script tag
```html ```html
<script src="https://code.jquery.com/jquery-3.2.1.min.js"></script> <script src="https://code.jquery.com/jquery-3.3.0.min.js"></script>
``` ```
#### Babel #### Babel
......
...@@ -16,15 +16,18 @@ define( [ ...@@ -16,15 +16,18 @@ define( [
"./var/fnToString", "./var/fnToString",
"./var/ObjectFunctionString", "./var/ObjectFunctionString",
"./var/support", "./var/support",
"./core/DOMEval" "./var/isFunction",
"./var/isWindow",
"./core/DOMEval",
"./core/toType"
], function( arr, document, getProto, slice, concat, push, indexOf, ], function( arr, document, getProto, slice, concat, push, indexOf,
class2type, toString, hasOwn, fnToString, ObjectFunctionString, class2type, toString, hasOwn, fnToString, ObjectFunctionString,
support, DOMEval ) { support, isFunction, isWindow, DOMEval, toType ) {
"use strict"; "use strict";
var var
version = "3.2.1", version = "3.3.0",
// Define a local copy of jQuery // Define a local copy of jQuery
jQuery = function( selector, context ) { jQuery = function( selector, context ) {
...@@ -36,16 +39,7 @@ var ...@@ -36,16 +39,7 @@ var
// Support: Android <=4.0 only // Support: Android <=4.0 only
// Make sure we trim BOM and NBSP // Make sure we trim BOM and NBSP
rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;
// Matches dashed string for camelizing
rmsPrefix = /^-ms-/,
rdashAlpha = /-([a-z])/g,
// Used by jQuery.camelCase as callback to replace()
fcamelCase = function( all, letter ) {
return letter.toUpperCase();
};
jQuery.fn = jQuery.prototype = { jQuery.fn = jQuery.prototype = {
...@@ -145,7 +139,7 @@ jQuery.extend = jQuery.fn.extend = function() { ...@@ -145,7 +139,7 @@ jQuery.extend = jQuery.fn.extend = function() {
} }
// Handle case when target is a string or something (possible in deep copy) // Handle case when target is a string or something (possible in deep copy)
if ( typeof target !== "object" && !jQuery.isFunction( target ) ) { if ( typeof target !== "object" && !isFunction( target ) ) {
target = {}; target = {};
} }
...@@ -211,28 +205,6 @@ jQuery.extend( { ...@@ -211,28 +205,6 @@ jQuery.extend( {
noop: function() {}, noop: function() {},
isFunction: function( obj ) {
return jQuery.type( obj ) === "function";
},
isWindow: function( obj ) {
return obj != null && obj === obj.window;
},
isNumeric: function( obj ) {
// As of jQuery 3.0, isNumeric is limited to
// strings and numbers (primitives or objects)
// that can be coerced to finite numbers (gh-2662)
var type = jQuery.type( obj );
return ( type === "number" || type === "string" ) &&
// parseFloat NaNs numeric-cast false positives ("")
// ...but misinterprets leading-number strings, particularly hex literals ("0x...")
// subtraction forces infinities to NaN
!isNaN( obj - parseFloat( obj ) );
},
isPlainObject: function( obj ) { isPlainObject: function( obj ) {
var proto, Ctor; var proto, Ctor;
...@@ -266,29 +238,11 @@ jQuery.extend( { ...@@ -266,29 +238,11 @@ jQuery.extend( {
return true; return true;
}, },
type: function( obj ) {
if ( obj == null ) {
return obj + "";
}
// Support: Android <=2.3 only (functionish RegExp)
return typeof obj === "object" || typeof obj === "function" ?
class2type[ toString.call( obj ) ] || "object" :
typeof obj;
},
// Evaluates a script in a global context // Evaluates a script in a global context
globalEval: function( code ) { globalEval: function( code ) {
DOMEval( code ); DOMEval( code );
}, },
// Convert dashed to camelCase; used by the css and data modules
// Support: IE <=9 - 11, Edge 12 - 13
// Microsoft forgot to hump their vendor prefix (#9572)
camelCase: function( string ) {
return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
},
each: function( obj, callback ) { each: function( obj, callback ) {
var length, i = 0; var length, i = 0;
...@@ -409,37 +363,6 @@ jQuery.extend( { ...@@ -409,37 +363,6 @@ jQuery.extend( {
// A global GUID counter for objects // A global GUID counter for objects
guid: 1, guid: 1,
// Bind a function to a context, optionally partially applying any
// arguments.
proxy: function( fn, context ) {
var tmp, args, proxy;
if ( typeof context === "string" ) {
tmp = fn[ context ];
context = fn;
fn = tmp;
}
// Quick check to determine if target is callable, in the spec
// this throws a TypeError, but we will just return undefined.
if ( !jQuery.isFunction( fn ) ) {
return undefined;
}
// Simulated bind
args = slice.call( arguments, 2 );
proxy = function() {
return fn.apply( context || this, args.concat( slice.call( arguments ) ) );
};
// Set the guid of unique handler to the same of original handler, so it can be removed
proxy.guid = fn.guid = fn.guid || jQuery.guid++;
return proxy;
},
now: Date.now,
// jQuery.support is not used in Core but other projects attach their // jQuery.support is not used in Core but other projects attach their
// properties to it so it needs to exist. // properties to it so it needs to exist.
support: support support: support
...@@ -462,9 +385,9 @@ function isArrayLike( obj ) { ...@@ -462,9 +385,9 @@ function isArrayLike( obj ) {
// hasOwn isn't used here due to false negatives // hasOwn isn't used here due to false negatives
// regarding Nodelist length in IE // regarding Nodelist length in IE
var length = !!obj && "length" in obj && obj.length, var length = !!obj && "length" in obj && obj.length,
type = jQuery.type( obj ); type = toType( obj );
if ( type === "function" || jQuery.isWindow( obj ) ) { if ( isFunction( obj ) || isWindow( obj ) ) {
return false; return false;
} }
......
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.2.1", "version": "3.3.0",
"main": "dist/jquery.js", "main": "dist/jquery.js",
"homepage": "https://jquery.com", "homepage": "https://jquery.com",
"author": { "author": {
"name": "JS Foundation and other contributors", "name": "JS Foundation and other contributors",
"url": "https://github.com/jquery/jquery/blob/3.2.1/AUTHORS.txt" "url": "https://github.com/jquery/jquery/blob/3.3.0/AUTHORS.txt"
}, },
"repository": { "repository": {
"type": "git", "type": "git",
...@@ -23,45 +23,61 @@ ...@@ -23,45 +23,61 @@
"url": "https://github.com/jquery/jquery/issues" "url": "https://github.com/jquery/jquery/issues"
}, },
"license": "MIT", "license": "MIT",
"dependencies": {}, "dependencies": {
"archiver": "1.3.0",
"chalk": "1.1.3",
"npm": "4.4.1",
"shelljs": "0.7.7"
},
"devDependencies": { "devDependencies": {
"babel-preset-es2015": "6.6.0", "babel-core": "7.0.0-beta.0",
"commitplease": "2.6.1", "babel-plugin-transform-es2015-for-of": "7.0.0-beta.0",
"core-js": "2.2.2", "commitplease": "2.7.10",
"cross-spawn": "2.2.3", "core-js": "2.4.1",
"eslint-config-jquery": "1.0.0", "eslint-config-jquery": "1.0.1",
"grunt": "1.0.1", "grunt": "1.0.1",
"grunt-babel": "6.0.0", "grunt-babel": "7.0.0",
"grunt-cli": "1.2.0", "grunt-cli": "1.2.0",
"grunt-compare-size": "0.4.2", "grunt-compare-size": "0.4.2",
"grunt-contrib-uglify": "1.0.1", "grunt-contrib-uglify": "3.0.1",
"grunt-contrib-watch": "1.0.0", "grunt-contrib-watch": "1.0.0",
"grunt-eslint": "19.0.0", "grunt-eslint": "20.0.0",
"grunt-git-authors": "3.2.0", "grunt-git-authors": "3.2.0",
"grunt-jsonlint": "1.0.7", "grunt-jsonlint": "1.1.0",
"grunt-newer": "1.2.0", "grunt-karma": "2.0.0",
"grunt-newer": "1.3.0",
"grunt-npmcopy": "0.1.0", "grunt-npmcopy": "0.1.0",
"gzip-js": "0.3.2", "gzip-js": "0.3.2",
"husky": "0.11.4", "husky": "0.14.3",
"insight": "0.8.1", "insight": "0.8.4",
"jsdom": "5.6.1", "jsdom": "5.6.1",
"load-grunt-tasks": "3.5.0", "karma": "1.7.0",
"karma-browserstack-launcher": "1.3.0",
"karma-chrome-launcher": "2.2.0",
"karma-firefox-launcher": "1.0.1",
"karma-qunit": "1.2.1",
"load-grunt-tasks": "3.5.2",
"native-promise-only": "0.8.1", "native-promise-only": "0.8.1",
"promises-aplus-tests": "2.1.2", "promises-aplus-tests": "2.1.2",
"q": "1.4.1", "q": "1.5.0",
"qunit-assert-step": "1.0.3", "qunit-assert-step": "1.0.3",
"qunitjs": "1.23.1", "qunitjs": "1.23.1",
"requirejs": "2.2.0", "raw-body": "2.2.0",
"sinon": "1.17.3", "requirejs": "2.3.3",
"sinon": "2.3.7",
"sizzle": "2.3.3", "sizzle": "2.3.3",
"strip-json-comments": "2.0.1", "strip-json-comments": "2.0.1",
"testswarm": "1.1.0" "testswarm": "1.1.0",
"uglify-js": "3.3.4"
}, },
"scripts": { "scripts": {
"build": "npm install && grunt", "build": "npm install && grunt",
"start": "grunt watch", "start": "grunt watch",
"test": "grunt && grunt test:slow", "test:browserless": "grunt && grunt test:slow",
"precommit": "grunt lint:newer", "test:browser": "grunt && grunt karma:main",
"test": "grunt && grunt test:slow && grunt karma:main",
"jenkins": "npm run test:browserless",
"precommit": "grunt lint:newer qunit_fixture",
"commitmsg": "node node_modules/commitplease" "commitmsg": "node node_modules/commitplease"
}, },
"commitplease": { "commitplease": {
......
define( [ define( [
"./core", "./core",
"./var/document", "./var/document",
"./var/isFunction",
"./var/rnothtmlwhite", "./var/rnothtmlwhite",
"./ajax/var/location", "./ajax/var/location",
"./ajax/var/nonce", "./ajax/var/nonce",
...@@ -11,7 +12,7 @@ define( [ ...@@ -11,7 +12,7 @@ define( [
"./event/trigger", "./event/trigger",
"./deferred", "./deferred",
"./serialize" // jQuery.param "./serialize" // jQuery.param
], function( jQuery, document, rnothtmlwhite, location, nonce, rquery ) { ], function( jQuery, document, isFunction, rnothtmlwhite, location, nonce, rquery ) {
"use strict"; "use strict";
...@@ -66,7 +67,7 @@ function addToPrefiltersOrTransports( structure ) { ...@@ -66,7 +67,7 @@ function addToPrefiltersOrTransports( structure ) {
i = 0, i = 0,
dataTypes = dataTypeExpression.toLowerCase().match( rnothtmlwhite ) || []; dataTypes = dataTypeExpression.toLowerCase().match( rnothtmlwhite ) || [];
if ( jQuery.isFunction( func ) ) { if ( isFunction( func ) ) {
// For each dataType in the dataTypeExpression // For each dataType in the dataTypeExpression
while ( ( dataType = dataTypes[ i++ ] ) ) { while ( ( dataType = dataTypes[ i++ ] ) ) {
...@@ -538,7 +539,7 @@ jQuery.extend( { ...@@ -538,7 +539,7 @@ jQuery.extend( {
if ( s.crossDomain == null ) { if ( s.crossDomain == null ) {
urlAnchor = document.createElement( "a" ); urlAnchor = document.createElement( "a" );
// Support: IE <=8 - 11, Edge 12 - 13 // Support: IE <=8 - 11, Edge 12 - 15
// IE throws exception on accessing the href property if url is malformed, // IE throws exception on accessing the href property if url is malformed,
// e.g. http://example.com:80x/ // e.g. http://example.com:80x/
try { try {
...@@ -596,8 +597,8 @@ jQuery.extend( { ...@@ -596,8 +597,8 @@ jQuery.extend( {
// Remember the hash so we can put it back // Remember the hash so we can put it back
uncached = s.url.slice( cacheURL.length ); uncached = s.url.slice( cacheURL.length );
// If data is available, append data to url // If data is available and should be processed, append data to url
if ( s.data ) { if ( s.data && ( s.processData || typeof s.data === "string" ) ) {
cacheURL += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data; cacheURL += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data;
// #9682: remove data so that it's not used in an eventual retry // #9682: remove data so that it's not used in an eventual retry
...@@ -834,7 +835,7 @@ jQuery.each( [ "get", "post" ], function( i, method ) { ...@@ -834,7 +835,7 @@ jQuery.each( [ "get", "post" ], function( i, method ) {
jQuery[ method ] = function( url, data, callback, type ) { jQuery[ method ] = function( url, data, callback, type ) {
// Shift arguments if data argument was omitted // Shift arguments if data argument was omitted
if ( jQuery.isFunction( data ) ) { if ( isFunction( data ) ) {
type = type || callback; type = type || callback;
callback = data; callback = data;
data = undefined; data = undefined;
......
define( [ define( [
"../core", "../core",
"../var/isFunction",
"./var/nonce", "./var/nonce",
"./var/rquery", "./var/rquery",
"../ajax" "../ajax"
], function( jQuery, nonce, rquery ) { ], function( jQuery, isFunction, nonce, rquery ) {
"use strict"; "use strict";
...@@ -36,7 +37,7 @@ jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) { ...@@ -36,7 +37,7 @@ jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) { if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) {
// Get callback name, remembering preexisting value associated with it // Get callback name, remembering preexisting value associated with it
callbackName = s.jsonpCallback = jQuery.isFunction( s.jsonpCallback ) ? callbackName = s.jsonpCallback = isFunction( s.jsonpCallback ) ?
s.jsonpCallback() : s.jsonpCallback() :
s.jsonpCallback; s.jsonpCallback;
...@@ -87,7 +88,7 @@ jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) { ...@@ -87,7 +88,7 @@ jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
} }
// Call if it was a function and we have a response // Call if it was a function and we have a response
if ( responseContainer && jQuery.isFunction( overwritten ) ) { if ( responseContainer && isFunction( overwritten ) ) {
overwritten( responseContainer[ 0 ] ); overwritten( responseContainer[ 0 ] );
} }
......
define( [ define( [
"../core", "../core",
"../core/stripAndCollapse", "../core/stripAndCollapse",
"../var/isFunction",
"../core/parseHTML", "../core/parseHTML",
"../ajax", "../ajax",
"../traversing", "../traversing",
"../manipulation", "../manipulation",
"../selector" "../selector"
], function( jQuery, stripAndCollapse ) { ], function( jQuery, stripAndCollapse, isFunction ) {
"use strict"; "use strict";
...@@ -24,7 +25,7 @@ jQuery.fn.load = function( url, params, callback ) { ...@@ -24,7 +25,7 @@ jQuery.fn.load = function( url, params, callback ) {
} }
// If it's a function // If it's a function
if ( jQuery.isFunction( params ) ) { if ( isFunction( params ) ) {
// We assume that it's the callback // We assume that it's the callback
callback = params; callback = params;
......
define( [ define( function() {
"../../core"
], function( jQuery ) {
"use strict"; "use strict";
return jQuery.now(); return Date.now();
} ); } );
...@@ -75,7 +75,8 @@ jQuery.ajaxTransport( function( options ) { ...@@ -75,7 +75,8 @@ jQuery.ajaxTransport( function( options ) {
return function() { return function() {
if ( callback ) { if ( callback ) {
callback = errorCallback = xhr.onload = callback = errorCallback = xhr.onload =
xhr.onerror = xhr.onabort = xhr.onreadystatechange = null; xhr.onerror = xhr.onabort = xhr.ontimeout =
xhr.onreadystatechange = null;
if ( type === "abort" ) { if ( type === "abort" ) {
xhr.abort(); xhr.abort();
...@@ -115,7 +116,7 @@ jQuery.ajaxTransport( function( options ) { ...@@ -115,7 +116,7 @@ jQuery.ajaxTransport( function( options ) {
// Listen to events // Listen to events
xhr.onload = callback(); xhr.onload = callback();
errorCallback = xhr.onerror = callback( "error" ); errorCallback = xhr.onerror = xhr.ontimeout = callback( "error" );
// Support: IE 9 only // Support: IE 9 only
// Use onreadystatechange to replace onabort // Use onreadystatechange to replace onabort
......
define( [ define( [
"../core", "../core",
"../core/stripAndCollapse", "../core/stripAndCollapse",
"../var/isFunction",
"../var/rnothtmlwhite", "../var/rnothtmlwhite",
"../data/var/dataPriv", "../data/var/dataPriv",
"../core/init" "../core/init"
], function( jQuery, stripAndCollapse, rnothtmlwhite, dataPriv ) { ], function( jQuery, stripAndCollapse, isFunction, rnothtmlwhite, dataPriv ) {
"use strict"; "use strict";
...@@ -12,20 +13,30 @@ function getClass( elem ) { ...@@ -12,20 +13,30 @@ function getClass( elem ) {
return elem.getAttribute && elem.getAttribute( "class" ) || ""; return elem.getAttribute && elem.getAttribute( "class" ) || "";
} }
function classesToArray( value ) {
if ( Array.isArray( value ) ) {
return value;
}
if ( typeof value === "string" ) {
return value.match( rnothtmlwhite ) || [];
}
return [];
}
jQuery.fn.extend( { jQuery.fn.extend( {
addClass: function( value ) { addClass: function( value ) {
var classes, elem, cur, curValue, clazz, j, finalValue, var classes, elem, cur, curValue, clazz, j, finalValue,
i = 0; i = 0;
if ( jQuery.isFunction( value ) ) { if ( isFunction( value ) ) {
return this.each( function( j ) { return this.each( function( j ) {
jQuery( this ).addClass( value.call( this, j, getClass( this ) ) ); jQuery( this ).addClass( value.call( this, j, getClass( this ) ) );
} ); } );
} }
if ( typeof value === "string" && value ) { classes = classesToArray( value );
classes = value.match( rnothtmlwhite ) || [];
if ( classes.length ) {
while ( ( elem = this[ i++ ] ) ) { while ( ( elem = this[ i++ ] ) ) {
curValue = getClass( elem ); curValue = getClass( elem );
cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " ); cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
...@@ -54,7 +65,7 @@ jQuery.fn.extend( { ...@@ -54,7 +65,7 @@ jQuery.fn.extend( {
var classes, elem, cur, curValue, clazz, j, finalValue, var classes, elem, cur, curValue, clazz, j, finalValue,
i = 0; i = 0;
if ( jQuery.isFunction( value ) ) { if ( isFunction( value ) ) {
return this.each( function( j ) { return this.each( function( j ) {
jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) ); jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) );
} ); } );
...@@ -64,9 +75,9 @@ jQuery.fn.extend( { ...@@ -64,9 +75,9 @@ jQuery.fn.extend( {
return this.attr( "class", "" ); return this.attr( "class", "" );
} }
if ( typeof value === "string" && value ) { classes = classesToArray( value );
classes = value.match( rnothtmlwhite ) || [];
if ( classes.length ) {
while ( ( elem = this[ i++ ] ) ) { while ( ( elem = this[ i++ ] ) ) {
curValue = getClass( elem ); curValue = getClass( elem );
...@@ -96,13 +107,14 @@ jQuery.fn.extend( { ...@@ -96,13 +107,14 @@ jQuery.fn.extend( {
}, },
toggleClass: function( value, stateVal ) { toggleClass: function( value, stateVal ) {
var type = typeof value; var type = typeof value,
isValidValue = type === "string" || Array.isArray( value );
if ( typeof stateVal === "boolean" && type === "string" ) { if ( typeof stateVal === "boolean" && isValidValue ) {
return stateVal ? this.addClass( value ) : this.removeClass( value ); return stateVal ? this.addClass( value ) : this.removeClass( value );
} }
if ( jQuery.isFunction( value ) ) { if ( isFunction( value ) ) {
return this.each( function( i ) { return this.each( function( i ) {
jQuery( this ).toggleClass( jQuery( this ).toggleClass(
value.call( this, i, getClass( this ), stateVal ), value.call( this, i, getClass( this ), stateVal ),
...@@ -114,12 +126,12 @@ jQuery.fn.extend( { ...@@ -114,12 +126,12 @@ jQuery.fn.extend( {
return this.each( function() { return this.each( function() {
var className, i, self, classNames; var className, i, self, classNames;
if ( type === "string" ) { if ( isValidValue ) {
// Toggle individual class names // Toggle individual class names
i = 0; i = 0;
self = jQuery( this ); self = jQuery( this );
classNames = value.match( rnothtmlwhite ) || []; classNames = classesToArray( value );
while ( ( className = classNames[ i++ ] ) ) { while ( ( className = classNames[ i++ ] ) ) {
......
...@@ -3,9 +3,10 @@ define( [ ...@@ -3,9 +3,10 @@ define( [
"../core/stripAndCollapse", "../core/stripAndCollapse",
"./support", "./support",
"../core/nodeName", "../core/nodeName",
"../var/isFunction",
"../core/init" "../core/init"
], function( jQuery, stripAndCollapse, support, nodeName ) { ], function( jQuery, stripAndCollapse, support, nodeName, isFunction ) {
"use strict"; "use strict";
...@@ -13,7 +14,7 @@ var rreturn = /\r/g; ...@@ -13,7 +14,7 @@ var rreturn = /\r/g;
jQuery.fn.extend( { jQuery.fn.extend( {
val: function( value ) { val: function( value ) {
var hooks, ret, isFunction, var hooks, ret, valueIsFunction,
elem = this[ 0 ]; elem = this[ 0 ];
if ( !arguments.length ) { if ( !arguments.length ) {
...@@ -42,7 +43,7 @@ jQuery.fn.extend( { ...@@ -42,7 +43,7 @@ jQuery.fn.extend( {
return; return;
} }
isFunction = jQuery.isFunction( value ); valueIsFunction = isFunction( value );
return this.each( function( i ) { return this.each( function( i ) {
var val; var val;
...@@ -51,7 +52,7 @@ jQuery.fn.extend( { ...@@ -51,7 +52,7 @@ jQuery.fn.extend( {
return; return;
} }
if ( isFunction ) { if ( valueIsFunction ) {
val = value.call( this, i, jQuery( this ).val() ); val = value.call( this, i, jQuery( this ).val() );
} else { } else {
val = value; val = value;
......
define( [ define( [
"./core", "./core",
"./core/toType",
"./var/isFunction",
"./var/rnothtmlwhite" "./var/rnothtmlwhite"
], function( jQuery, rnothtmlwhite ) { ], function( jQuery, toType, isFunction, rnothtmlwhite ) {
"use strict"; "use strict";
...@@ -125,11 +127,11 @@ jQuery.Callbacks = function( options ) { ...@@ -125,11 +127,11 @@ jQuery.Callbacks = function( options ) {
( function add( args ) { ( function add( args ) {
jQuery.each( args, function( _, arg ) { jQuery.each( args, function( _, arg ) {
if ( jQuery.isFunction( arg ) ) { if ( isFunction( arg ) ) {
if ( !options.unique || !self.has( arg ) ) { if ( !options.unique || !self.has( arg ) ) {
list.push( arg ); list.push( arg );
} }
} else if ( arg && arg.length && jQuery.type( arg ) !== "string" ) { } else if ( arg && arg.length && toType( arg ) !== "string" ) {
// Inspect recursively // Inspect recursively
add( arg ); add( arg );
......
...@@ -16,15 +16,18 @@ define( [ ...@@ -16,15 +16,18 @@ define( [
"./var/fnToString", "./var/fnToString",
"./var/ObjectFunctionString", "./var/ObjectFunctionString",
"./var/support", "./var/support",
"./core/DOMEval" "./var/isFunction",
"./var/isWindow",
"./core/DOMEval",
"./core/toType"
], function( arr, document, getProto, slice, concat, push, indexOf, ], function( arr, document, getProto, slice, concat, push, indexOf,
class2type, toString, hasOwn, fnToString, ObjectFunctionString, class2type, toString, hasOwn, fnToString, ObjectFunctionString,
support, DOMEval ) { support, isFunction, isWindow, DOMEval, toType ) {
"use strict"; "use strict";
var var
version = "3.2.1", version = "3.3.0",
// Define a local copy of jQuery // Define a local copy of jQuery
jQuery = function( selector, context ) { jQuery = function( selector, context ) {
...@@ -36,16 +39,7 @@ var ...@@ -36,16 +39,7 @@ var
// Support: Android <=4.0 only // Support: Android <=4.0 only
// Make sure we trim BOM and NBSP // Make sure we trim BOM and NBSP
rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;
// Matches dashed string for camelizing
rmsPrefix = /^-ms-/,
rdashAlpha = /-([a-z])/g,
// Used by jQuery.camelCase as callback to replace()
fcamelCase = function( all, letter ) {
return letter.toUpperCase();
};
jQuery.fn = jQuery.prototype = { jQuery.fn = jQuery.prototype = {
...@@ -145,7 +139,7 @@ jQuery.extend = jQuery.fn.extend = function() { ...@@ -145,7 +139,7 @@ jQuery.extend = jQuery.fn.extend = function() {
} }
// Handle case when target is a string or something (possible in deep copy) // Handle case when target is a string or something (possible in deep copy)
if ( typeof target !== "object" && !jQuery.isFunction( target ) ) { if ( typeof target !== "object" && !isFunction( target ) ) {
target = {}; target = {};
} }
...@@ -211,28 +205,6 @@ jQuery.extend( { ...@@ -211,28 +205,6 @@ jQuery.extend( {
noop: function() {}, noop: function() {},
isFunction: function( obj ) {
return jQuery.type( obj ) === "function";
},
isWindow: function( obj ) {
return obj != null && obj === obj.window;
},
isNumeric: function( obj ) {
// As of jQuery 3.0, isNumeric is limited to
// strings and numbers (primitives or objects)
// that can be coerced to finite numbers (gh-2662)
var type = jQuery.type( obj );
return ( type === "number" || type === "string" ) &&
// parseFloat NaNs numeric-cast false positives ("")
// ...but misinterprets leading-number strings, particularly hex literals ("0x...")
// subtraction forces infinities to NaN
!isNaN( obj - parseFloat( obj ) );
},
isPlainObject: function( obj ) { isPlainObject: function( obj ) {
var proto, Ctor; var proto, Ctor;
...@@ -266,29 +238,11 @@ jQuery.extend( { ...@@ -266,29 +238,11 @@ jQuery.extend( {
return true; return true;
}, },
type: function( obj ) {
if ( obj == null ) {
return obj + "";
}
// Support: Android <=2.3 only (functionish RegExp)
return typeof obj === "object" || typeof obj === "function" ?
class2type[ toString.call( obj ) ] || "object" :
typeof obj;
},
// Evaluates a script in a global context // Evaluates a script in a global context
globalEval: function( code ) { globalEval: function( code ) {
DOMEval( code ); DOMEval( code );
}, },
// Convert dashed to camelCase; used by the css and data modules
// Support: IE <=9 - 11, Edge 12 - 13
// Microsoft forgot to hump their vendor prefix (#9572)
camelCase: function( string ) {
return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
},
each: function( obj, callback ) { each: function( obj, callback ) {
var length, i = 0; var length, i = 0;
...@@ -409,37 +363,6 @@ jQuery.extend( { ...@@ -409,37 +363,6 @@ jQuery.extend( {
// A global GUID counter for objects // A global GUID counter for objects
guid: 1, guid: 1,
// Bind a function to a context, optionally partially applying any
// arguments.
proxy: function( fn, context ) {
var tmp, args, proxy;
if ( typeof context === "string" ) {
tmp = fn[ context ];
context = fn;
fn = tmp;
}
// Quick check to determine if target is callable, in the spec
// this throws a TypeError, but we will just return undefined.
if ( !jQuery.isFunction( fn ) ) {
return undefined;
}
// Simulated bind
args = slice.call( arguments, 2 );
proxy = function() {
return fn.apply( context || this, args.concat( slice.call( arguments ) ) );
};
// Set the guid of unique handler to the same of original handler, so it can be removed
proxy.guid = fn.guid = fn.guid || jQuery.guid++;
return proxy;
},
now: Date.now,
// jQuery.support is not used in Core but other projects attach their // jQuery.support is not used in Core but other projects attach their
// properties to it so it needs to exist. // properties to it so it needs to exist.
support: support support: support
...@@ -462,9 +385,9 @@ function isArrayLike( obj ) { ...@@ -462,9 +385,9 @@ function isArrayLike( obj ) {
// hasOwn isn't used here due to false negatives // hasOwn isn't used here due to false negatives
// regarding Nodelist length in IE // regarding Nodelist length in IE
var length = !!obj && "length" in obj && obj.length, var length = !!obj && "length" in obj && obj.length,
type = jQuery.type( obj ); type = toType( obj );
if ( type === "function" || jQuery.isWindow( obj ) ) { if ( isFunction( obj ) || isWindow( obj ) ) {
return false; return false;
} }
......
...@@ -3,12 +3,26 @@ define( [ ...@@ -3,12 +3,26 @@ define( [
], function( document ) { ], function( document ) {
"use strict"; "use strict";
function DOMEval( code, doc ) { var preservedScriptAttributes = {
type: true,
src: true,
noModule: true
};
function DOMEval( code, doc, node ) {
doc = doc || document; doc = doc || document;
var script = doc.createElement( "script" ); var i,
script = doc.createElement( "script" );
script.text = code; script.text = code;
if ( node ) {
for ( i in preservedScriptAttributes ) {
if ( node[ i ] ) {
script[ i ] = node[ i ];
}
}
}
doc.head.appendChild( script ).parentNode.removeChild( script ); doc.head.appendChild( script ).parentNode.removeChild( script );
} }
......
define( [ define( [
"../core" "../core",
], function( jQuery ) { "../core/toType",
"../var/isFunction"
], function( jQuery, toType, isFunction ) {
"use strict"; "use strict";
...@@ -12,7 +14,7 @@ var access = function( elems, fn, key, value, chainable, emptyGet, raw ) { ...@@ -12,7 +14,7 @@ var access = function( elems, fn, key, value, chainable, emptyGet, raw ) {
bulk = key == null; bulk = key == null;
// Sets many values // Sets many values
if ( jQuery.type( key ) === "object" ) { if ( toType( key ) === "object" ) {
chainable = true; chainable = true;
for ( i in key ) { for ( i in key ) {
access( elems, fn, i, key[ i ], true, emptyGet, raw ); access( elems, fn, i, key[ i ], true, emptyGet, raw );
...@@ -22,7 +24,7 @@ var access = function( elems, fn, key, value, chainable, emptyGet, raw ) { ...@@ -22,7 +24,7 @@ var access = function( elems, fn, key, value, chainable, emptyGet, raw ) {
} else if ( value !== undefined ) { } else if ( value !== undefined ) {
chainable = true; chainable = true;
if ( !jQuery.isFunction( value ) ) { if ( !isFunction( value ) ) {
raw = true; raw = true;
} }
......
define( [], function() {
"use strict";
// Matches dashed string for camelizing
var rmsPrefix = /^-ms-/,
rdashAlpha = /-([a-z])/g;
// Used by camelCase as callback to replace()
function fcamelCase( all, letter ) {
return letter.toUpperCase();
}
// Convert dashed to camelCase; used by the css and data modules
// Support: IE <=9 - 11, Edge 12 - 15
// Microsoft forgot to hump their vendor prefix (#9572)
function camelCase( string ) {
return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
}
return camelCase;
} );
...@@ -2,10 +2,11 @@ ...@@ -2,10 +2,11 @@
define( [ define( [
"../core", "../core",
"../var/document", "../var/document",
"../var/isFunction",
"./var/rsingleTag", "./var/rsingleTag",
"../traversing/findFilter" "../traversing/findFilter"
], function( jQuery, document, rsingleTag ) { ], function( jQuery, document, isFunction, rsingleTag ) {
"use strict"; "use strict";
...@@ -63,7 +64,7 @@ var rootjQuery, ...@@ -63,7 +64,7 @@ var rootjQuery,
for ( match in context ) { for ( match in context ) {
// Properties of context are called as methods if possible // Properties of context are called as methods if possible
if ( jQuery.isFunction( this[ match ] ) ) { if ( isFunction( this[ match ] ) ) {
this[ match ]( context[ match ] ); this[ match ]( context[ match ] );
// ...and otherwise set as attributes // ...and otherwise set as attributes
...@@ -106,7 +107,7 @@ var rootjQuery, ...@@ -106,7 +107,7 @@ var rootjQuery,
// HANDLE: $(function) // HANDLE: $(function)
// Shortcut for document ready // Shortcut for document ready
} else if ( jQuery.isFunction( selector ) ) { } else if ( isFunction( selector ) ) {
return root.ready !== undefined ? return root.ready !== undefined ?
root.ready( selector ) : root.ready( selector ) :
......
define( [ define( [
"../core", "../core",
"../var/document" "../var/document",
], function( jQuery, document ) { "../var/isFunction"
], function( jQuery, document, isFunction ) {
"use strict"; "use strict";
...@@ -52,7 +53,7 @@ jQuery.extend( { ...@@ -52,7 +53,7 @@ jQuery.extend( {
while ( readyCallbacks.length ) { while ( readyCallbacks.length ) {
fn = readyCallbacks.shift(); fn = readyCallbacks.shift();
if ( jQuery.isFunction( fn ) ) { if ( isFunction( fn ) ) {
executeReady( fn ); executeReady( fn );
} }
} }
......
...@@ -4,7 +4,7 @@ define( [ ...@@ -4,7 +4,7 @@ define( [
"use strict"; "use strict";
// Strip and collapse whitespace according to HTML spec // Strip and collapse whitespace according to HTML spec
// https://html.spec.whatwg.org/multipage/infrastructure.html#strip-and-collapse-whitespace // https://infra.spec.whatwg.org/#strip-and-collapse-ascii-whitespace
function stripAndCollapse( value ) { function stripAndCollapse( value ) {
var tokens = value.match( rnothtmlwhite ) || []; var tokens = value.match( rnothtmlwhite ) || [];
return tokens.join( " " ); return tokens.join( " " );
......
define( [
"../var/class2type",
"../var/toString"
], function( class2type, toString ) {
"use strict";
function toType( obj ) {
if ( obj == null ) {
return obj + "";
}
// Support: Android <=2.3 only (functionish RegExp)
return typeof obj === "object" || typeof obj === "function" ?
class2type[ toString.call( obj ) ] || "object" :
typeof obj;
}
return toType;
} );
...@@ -2,7 +2,7 @@ define( [ ...@@ -2,7 +2,7 @@ define( [
"./core", "./core",
"./var/pnum", "./var/pnum",
"./core/access", "./core/access",
"./css/var/rmargin", "./core/camelCase",
"./var/document", "./var/document",
"./var/rcssNum", "./var/rcssNum",
"./css/var/rnumnonpx", "./css/var/rnumnonpx",
...@@ -17,7 +17,7 @@ define( [ ...@@ -17,7 +17,7 @@ define( [
"./core/init", "./core/init",
"./core/ready", "./core/ready",
"./selector" // contains "./selector" // contains
], function( jQuery, pnum, access, rmargin, document, rcssNum, rnumnonpx, cssExpand, ], function( jQuery, pnum, access, camelCase, document, rcssNum, rnumnonpx, cssExpand,
getStyles, swap, curCSS, adjustCSS, addGetHookIf, support ) { getStyles, swap, curCSS, adjustCSS, addGetHookIf, support ) {
"use strict"; "use strict";
...@@ -80,87 +80,120 @@ function setPositiveNumber( elem, value, subtract ) { ...@@ -80,87 +80,120 @@ function setPositiveNumber( elem, value, subtract ) {
value; value;
} }
function augmentWidthOrHeight( elem, name, extra, isBorderBox, styles ) { function boxModelAdjustment( elem, dimension, box, isBorderBox, styles, computedVal ) {
var i, var i = dimension === "width" ? 1 : 0,
val = 0; extra = 0,
delta = 0;
// If we already have the right measurement, avoid augmentation // Adjustment may not be necessary
if ( extra === ( isBorderBox ? "border" : "content" ) ) { if ( box === ( isBorderBox ? "border" : "content" ) ) {
i = 4; return 0;
// Otherwise initialize for horizontal or vertical properties
} else {
i = name === "width" ? 1 : 0;
} }
for ( ; i < 4; i += 2 ) { for ( ; i < 4; i += 2 ) {
// Both box models exclude margin, so add it if we want it // Both box models exclude margin
if ( extra === "margin" ) { if ( box === "margin" ) {
val += jQuery.css( elem, extra + cssExpand[ i ], true, styles ); delta += jQuery.css( elem, box + cssExpand[ i ], true, styles );
} }
if ( isBorderBox ) { // If we get here with a content-box, we're seeking "padding" or "border" or "margin"
if ( !isBorderBox ) {
// border-box includes padding, so remove it if we want content // Add padding
if ( extra === "content" ) { delta += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
val -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
}
// At this point, extra isn't border nor margin, so remove border // For "border" or "margin", add border
if ( extra !== "margin" ) { if ( box !== "padding" ) {
val -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); delta += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
// But still keep track of it otherwise
} else {
extra += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
} }
// If we get here with a border-box (content + padding + border), we're seeking "content" or
// "padding" or "margin"
} else { } else {
// At this point, extra isn't content, so add padding // For "content", subtract padding
val += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); if ( box === "content" ) {
delta -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
}
// At this point, extra isn't content nor padding, so add border // For "content" or "padding", subtract border
if ( extra !== "padding" ) { if ( box !== "margin" ) {
val += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); delta -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
} }
} }
} }
return val; // Account for positive content-box scroll gutter when requested by providing computedVal
if ( !isBorderBox && computedVal >= 0 ) {
// offsetWidth/offsetHeight is a rounded sum of content, padding, scroll gutter, and border
// Assuming integer scroll gutter, subtract the rest and round down
delta += Math.max( 0, Math.ceil(
elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] -
computedVal -
delta -
extra -
0.5
) );
}
return delta;
} }
function getWidthOrHeight( elem, name, extra ) { function getWidthOrHeight( elem, dimension, extra ) {
// Start with computed style // Start with computed style
var valueIsBorderBox, var styles = getStyles( elem ),
styles = getStyles( elem ), val = curCSS( elem, dimension, styles ),
val = curCSS( elem, name, styles ), isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box"; valueIsBorderBox = isBorderBox;
// Computed unit is not pixels. Stop here and return. // Support: Firefox <=54
// Return a confounding non-pixel value or feign ignorance, as appropriate.
if ( rnumnonpx.test( val ) ) { if ( rnumnonpx.test( val ) ) {
return val; if ( !extra ) {
return val;
}
val = "auto";
} }
// Check for style in case a browser which returns unreliable values // Check for style in case a browser which returns unreliable values
// for getComputedStyle silently falls back to the reliable elem.style // for getComputedStyle silently falls back to the reliable elem.style
valueIsBorderBox = isBorderBox && valueIsBorderBox = valueIsBorderBox &&
( support.boxSizingReliable() || val === elem.style[ name ] ); ( support.boxSizingReliable() || val === elem.style[ dimension ] );
// Fall back to offsetWidth/Height when value is "auto" // Fall back to offsetWidth/offsetHeight when value is "auto"
// This happens for inline elements with no explicit setting (gh-3571) // This happens for inline elements with no explicit setting (gh-3571)
if ( val === "auto" ) { // Support: Android <=4.1 - 4.3 only
val = elem[ "offset" + name[ 0 ].toUpperCase() + name.slice( 1 ) ]; // Also use offsetWidth/offsetHeight for misreported inline dimensions (gh-3602)
if ( val === "auto" ||
!parseFloat( val ) && jQuery.css( elem, "display", false, styles ) === "inline" ) {
val = elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ];
// offsetWidth/offsetHeight provide border-box values
valueIsBorderBox = true;
} }
// Normalize "", auto, and prepare for extra // Normalize "" and auto
val = parseFloat( val ) || 0; val = parseFloat( val ) || 0;
// Use the active box-sizing model to add/subtract irrelevant styles // Adjust for the element's box model
return ( val + return ( val +
augmentWidthOrHeight( boxModelAdjustment(
elem, elem,
name, dimension,
extra || ( isBorderBox ? "border" : "content" ), extra || ( isBorderBox ? "border" : "content" ),
valueIsBorderBox, valueIsBorderBox,
styles styles,
// Provide the current computed size to request scroll gutter calculation (gh-3589)
val
) )
) + "px"; ) + "px";
} }
...@@ -201,9 +234,7 @@ jQuery.extend( { ...@@ -201,9 +234,7 @@ jQuery.extend( {
// Add in properties whose names you wish to fix before // Add in properties whose names you wish to fix before
// setting or getting the value // setting or getting the value
cssProps: { cssProps: {},
"float": "cssFloat"
},
// Get and set the style property on a DOM Node // Get and set the style property on a DOM Node
style: function( elem, name, value, extra ) { style: function( elem, name, value, extra ) {
...@@ -215,7 +246,7 @@ jQuery.extend( { ...@@ -215,7 +246,7 @@ 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 = camelCase( name ),
isCustomProp = rcustomProp.test( name ), isCustomProp = rcustomProp.test( name ),
style = elem.style; style = elem.style;
...@@ -283,7 +314,7 @@ jQuery.extend( { ...@@ -283,7 +314,7 @@ 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 = camelCase( name ),
isCustomProp = rcustomProp.test( name ); isCustomProp = rcustomProp.test( name );
// Make sure that we're working with the right name. We don't // Make sure that we're working with the right name. We don't
...@@ -321,8 +352,8 @@ jQuery.extend( { ...@@ -321,8 +352,8 @@ jQuery.extend( {
} }
} ); } );
jQuery.each( [ "height", "width" ], function( i, name ) { jQuery.each( [ "height", "width" ], function( i, dimension ) {
jQuery.cssHooks[ name ] = { jQuery.cssHooks[ dimension ] = {
get: function( elem, computed, extra ) { get: function( elem, computed, extra ) {
if ( computed ) { if ( computed ) {
...@@ -338,29 +369,41 @@ jQuery.each( [ "height", "width" ], function( i, name ) { ...@@ -338,29 +369,41 @@ jQuery.each( [ "height", "width" ], function( i, name ) {
// in IE throws an error. // in IE throws an error.
( !elem.getClientRects().length || !elem.getBoundingClientRect().width ) ? ( !elem.getClientRects().length || !elem.getBoundingClientRect().width ) ?
swap( elem, cssShow, function() { swap( elem, cssShow, function() {
return getWidthOrHeight( elem, name, extra ); return getWidthOrHeight( elem, dimension, extra );
} ) : } ) :
getWidthOrHeight( elem, name, extra ); getWidthOrHeight( elem, dimension, extra );
} }
}, },
set: function( elem, value, extra ) { set: function( elem, value, extra ) {
var matches, var matches,
styles = extra && getStyles( elem ), styles = getStyles( elem ),
subtract = extra && augmentWidthOrHeight( isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
subtract = extra && boxModelAdjustment(
elem, elem,
name, dimension,
extra, extra,
jQuery.css( elem, "boxSizing", false, styles ) === "border-box", isBorderBox,
styles styles
); );
// Account for unreliable border-box dimensions by comparing offset* to computed and
// faking a content-box to get border and padding (gh-3699)
if ( isBorderBox && support.scrollboxSize() === styles.position ) {
subtract -= Math.ceil(
elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] -
parseFloat( styles[ dimension ] ) -
boxModelAdjustment( elem, dimension, "border", false, styles ) -
0.5
);
}
// Convert to pixels if value adjustment is needed // Convert to pixels if value adjustment is needed
if ( subtract && ( matches = rcssNum.exec( value ) ) && if ( subtract && ( matches = rcssNum.exec( value ) ) &&
( matches[ 3 ] || "px" ) !== "px" ) { ( matches[ 3 ] || "px" ) !== "px" ) {
elem.style[ name ] = value; elem.style[ dimension ] = value;
value = jQuery.css( elem, name ); value = jQuery.css( elem, dimension );
} }
return setPositiveNumber( elem, value, subtract ); return setPositiveNumber( elem, value, subtract );
...@@ -404,7 +447,7 @@ jQuery.each( { ...@@ -404,7 +447,7 @@ jQuery.each( {
} }
}; };
if ( !rmargin.test( prefix ) ) { if ( prefix !== "margin" ) {
jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber; jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber;
} }
} ); } );
......
...@@ -6,8 +6,7 @@ define( [ ...@@ -6,8 +6,7 @@ define( [
"use strict"; "use strict";
function adjustCSS( elem, prop, valueParts, tween ) { function adjustCSS( elem, prop, valueParts, tween ) {
var adjusted, var adjusted, scale,
scale = 1,
maxIterations = 20, maxIterations = 20,
currentValue = tween ? currentValue = tween ?
function() { function() {
...@@ -25,30 +24,33 @@ function adjustCSS( elem, prop, valueParts, tween ) { ...@@ -25,30 +24,33 @@ function adjustCSS( elem, prop, valueParts, tween ) {
if ( initialInUnit && initialInUnit[ 3 ] !== unit ) { if ( initialInUnit && initialInUnit[ 3 ] !== unit ) {
// Support: Firefox <=54
// Halve the iteration target value to prevent interference from CSS upper bounds (gh-2144)
initial = initial / 2;
// Trust units reported by jQuery.css // Trust units reported by jQuery.css
unit = unit || initialInUnit[ 3 ]; unit = unit || initialInUnit[ 3 ];
// Make sure we update the tween properties later on
valueParts = valueParts || [];
// Iteratively approximate from a nonzero starting point // Iteratively approximate from a nonzero starting point
initialInUnit = +initial || 1; initialInUnit = +initial || 1;
do { while ( maxIterations-- ) {
// If previous iteration zeroed out, double until we get *something*.
// Use string for doubling so we don't accidentally see scale as unchanged below
scale = scale || ".5";
// Adjust and apply // Evaluate and update our best guess (doubling guesses that zero out).
initialInUnit = initialInUnit / scale; // Finish if the scale equals or crosses 1 (making the old*new product non-positive).
jQuery.style( elem, prop, initialInUnit + unit ); jQuery.style( elem, prop, initialInUnit + unit );
if ( ( 1 - scale ) * ( 1 - ( scale = currentValue() / initial || 0.5 ) ) <= 0 ) {
maxIterations = 0;
}
initialInUnit = initialInUnit / scale;
}
// Update scale, tolerating zero or NaN from tween.cur() initialInUnit = initialInUnit * 2;
// Break the loop if scale is unchanged or perfect, or if we've just had enough. jQuery.style( elem, prop, initialInUnit + unit );
} while (
scale !== ( scale = currentValue() / initial ) && scale !== 1 && --maxIterations // Make sure we update the tween properties later on
); valueParts = valueParts || [];
} }
if ( valueParts ) { if ( valueParts ) {
......
define( [ define( [
"../core", "../core",
"./var/rboxStyle",
"./var/rnumnonpx", "./var/rnumnonpx",
"./var/rmargin",
"./var/getStyles", "./var/getStyles",
"./support", "./support",
"../selector" // Get jQuery.contains "../selector" // Get jQuery.contains
], function( jQuery, rnumnonpx, rmargin, getStyles, support ) { ], function( jQuery, rboxStyle, rnumnonpx, getStyles, support ) {
"use strict"; "use strict";
...@@ -35,7 +35,7 @@ function curCSS( elem, name, computed ) { ...@@ -35,7 +35,7 @@ function curCSS( elem, name, computed ) {
// but width seems to be reliably pixels. // but width seems to be reliably pixels.
// This is against the CSSOM draft spec: // This is against the CSSOM draft spec:
// https://drafts.csswg.org/cssom/#resolved-values // https://drafts.csswg.org/cssom/#resolved-values
if ( !support.pixelMarginRight() && rnumnonpx.test( ret ) && rmargin.test( name ) ) { if ( !support.pixelBoxStyles() && rnumnonpx.test( ret ) && rboxStyle.test( name ) ) {
// Remember the original values // Remember the original values
width = style.width; width = style.width;
......
...@@ -18,25 +18,33 @@ define( [ ...@@ -18,25 +18,33 @@ define( [
return; return;
} }
container.style.cssText = "position:absolute;left:-11111px;width:60px;" +
"margin-top:1px;padding:0;border:0";
div.style.cssText = div.style.cssText =
"box-sizing:border-box;" + "position:relative;display:block;box-sizing:border-box;overflow:scroll;" +
"position:relative;display:block;" +
"margin:auto;border:1px;padding:1px;" + "margin:auto;border:1px;padding:1px;" +
"top:1%;width:50%"; "width:60%;top:1%";
div.innerHTML = ""; documentElement.appendChild( container ).appendChild( div );
documentElement.appendChild( container );
var divStyle = window.getComputedStyle( div ); var divStyle = window.getComputedStyle( div );
pixelPositionVal = divStyle.top !== "1%"; pixelPositionVal = divStyle.top !== "1%";
// Support: Android 4.0 - 4.3 only, Firefox <=3 - 44 // Support: Android 4.0 - 4.3 only, Firefox <=3 - 44
reliableMarginLeftVal = divStyle.marginLeft === "2px"; reliableMarginLeftVal = roundPixelMeasures( divStyle.marginLeft ) === 12;
boxSizingReliableVal = divStyle.width === "4px";
// Support: Android 4.0 - 4.3 only // Support: Android 4.0 - 4.3 only, Safari <=9.1 - 10.1, iOS <=7.0 - 9.3
// Some styles come back with percentage values, even though they shouldn't // Some styles come back with percentage values, even though they shouldn't
div.style.marginRight = "50%"; div.style.right = "60%";
pixelMarginRightVal = divStyle.marginRight === "4px"; pixelBoxStylesVal = roundPixelMeasures( divStyle.right ) === 36;
// Support: IE 9 - 11 only
// Detect misreporting of content dimensions for box-sizing:border-box elements
boxSizingReliableVal = roundPixelMeasures( divStyle.width ) === 36;
// Support: IE 9 only
// Detect overflow:scroll screwiness (gh-3699)
div.style.position = "absolute";
scrollboxSizeVal = div.offsetWidth === 36 || "absolute";
documentElement.removeChild( container ); documentElement.removeChild( container );
...@@ -45,7 +53,12 @@ define( [ ...@@ -45,7 +53,12 @@ define( [
div = null; div = null;
} }
var pixelPositionVal, boxSizingReliableVal, pixelMarginRightVal, reliableMarginLeftVal, function roundPixelMeasures( measure ) {
return Math.round( parseFloat( measure ) );
}
var pixelPositionVal, boxSizingReliableVal, scrollboxSizeVal, pixelBoxStylesVal,
reliableMarginLeftVal,
container = document.createElement( "div" ), container = document.createElement( "div" ),
div = document.createElement( "div" ); div = document.createElement( "div" );
...@@ -60,26 +73,26 @@ define( [ ...@@ -60,26 +73,26 @@ define( [
div.cloneNode( true ).style.backgroundClip = ""; div.cloneNode( true ).style.backgroundClip = "";
support.clearCloneStyle = div.style.backgroundClip === "content-box"; support.clearCloneStyle = div.style.backgroundClip === "content-box";
container.style.cssText = "border:0;width:8px;height:0;top:0;left:-9999px;" +
"padding:0;margin-top:1px;position:absolute";
container.appendChild( div );
jQuery.extend( support, { jQuery.extend( support, {
pixelPosition: function() {
computeStyleTests();
return pixelPositionVal;
},
boxSizingReliable: function() { boxSizingReliable: function() {
computeStyleTests(); computeStyleTests();
return boxSizingReliableVal; return boxSizingReliableVal;
}, },
pixelMarginRight: function() { pixelBoxStyles: function() {
computeStyleTests(); computeStyleTests();
return pixelMarginRightVal; return pixelBoxStylesVal;
},
pixelPosition: function() {
computeStyleTests();
return pixelPositionVal;
}, },
reliableMarginLeft: function() { reliableMarginLeft: function() {
computeStyleTests(); computeStyleTests();
return reliableMarginLeftVal; return reliableMarginLeftVal;
},
scrollboxSize: function() {
computeStyleTests();
return scrollboxSizeVal;
} }
} ); } );
} )(); } )();
......
define( [
"./cssExpand"
], function( cssExpand ) {
"use strict";
return new RegExp( cssExpand.join( "|" ), "i" );
} );
define( [ define( [
"./core", "./core",
"./core/access", "./core/access",
"./core/camelCase",
"./data/var/dataPriv", "./data/var/dataPriv",
"./data/var/dataUser" "./data/var/dataUser"
], function( jQuery, access, dataPriv, dataUser ) { ], function( jQuery, access, camelCase, dataPriv, dataUser ) {
"use strict"; "use strict";
...@@ -112,7 +113,7 @@ jQuery.fn.extend( { ...@@ -112,7 +113,7 @@ jQuery.fn.extend( {
if ( attrs[ i ] ) { if ( attrs[ i ] ) {
name = attrs[ i ].name; name = attrs[ i ].name;
if ( name.indexOf( "data-" ) === 0 ) { if ( name.indexOf( "data-" ) === 0 ) {
name = jQuery.camelCase( name.slice( 5 ) ); name = camelCase( name.slice( 5 ) );
dataAttr( elem, name, data[ name ] ); dataAttr( elem, name, data[ name ] );
} }
} }
......
define( [ define( [
"../core", "../core",
"../core/camelCase",
"../var/rnothtmlwhite", "../var/rnothtmlwhite",
"./var/acceptData" "./var/acceptData"
], function( jQuery, rnothtmlwhite, acceptData ) { ], function( jQuery, camelCase, rnothtmlwhite, acceptData ) {
"use strict"; "use strict";
...@@ -54,14 +55,14 @@ Data.prototype = { ...@@ -54,14 +55,14 @@ Data.prototype = {
// Handle: [ owner, key, value ] args // Handle: [ owner, key, value ] args
// Always use camelCase key (gh-2257) // Always use camelCase key (gh-2257)
if ( typeof data === "string" ) { if ( typeof data === "string" ) {
cache[ jQuery.camelCase( data ) ] = value; cache[ camelCase( data ) ] = value;
// Handle: [ owner, { properties } ] args // Handle: [ owner, { properties } ] args
} else { } else {
// Copy the properties one-by-one to the cache object // Copy the properties one-by-one to the cache object
for ( prop in data ) { for ( prop in data ) {
cache[ jQuery.camelCase( prop ) ] = data[ prop ]; cache[ camelCase( prop ) ] = data[ prop ];
} }
} }
return cache; return cache;
...@@ -71,7 +72,7 @@ Data.prototype = { ...@@ -71,7 +72,7 @@ Data.prototype = {
this.cache( owner ) : this.cache( owner ) :
// Always use camelCase key (gh-2257) // Always use camelCase key (gh-2257)
owner[ this.expando ] && owner[ this.expando ][ jQuery.camelCase( key ) ]; owner[ this.expando ] && owner[ this.expando ][ camelCase( key ) ];
}, },
access: function( owner, key, value ) { access: function( owner, key, value ) {
...@@ -119,9 +120,9 @@ Data.prototype = { ...@@ -119,9 +120,9 @@ Data.prototype = {
// 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.
key = key.map( jQuery.camelCase ); key = key.map( camelCase );
} else { } else {
key = jQuery.camelCase( key ); key = camelCase( key );
// If a key with the spaces exists, use it. // If a key with the spaces exists, use it.
// Otherwise, create an array by matching non-whitespace // Otherwise, create an array by matching non-whitespace
......
define( [ define( [
"./core", "./core",
"./var/isFunction",
"./var/slice", "./var/slice",
"./callbacks" "./callbacks"
], function( jQuery, slice ) { ], function( jQuery, isFunction, slice ) {
"use strict"; "use strict";
...@@ -19,11 +20,11 @@ function adoptValue( value, resolve, reject, noValue ) { ...@@ -19,11 +20,11 @@ function adoptValue( value, resolve, reject, noValue ) {
try { try {
// Check for promise aspect first to privilege synchronous behavior // Check for promise aspect first to privilege synchronous behavior
if ( value && jQuery.isFunction( ( method = value.promise ) ) ) { if ( value && isFunction( ( method = value.promise ) ) ) {
method.call( value ).done( resolve ).fail( reject ); method.call( value ).done( resolve ).fail( reject );
// Other thenables // Other thenables
} else if ( value && jQuery.isFunction( ( method = value.then ) ) ) { } else if ( value && isFunction( ( method = value.then ) ) ) {
method.call( value, resolve, reject ); method.call( value, resolve, reject );
// Other non-thenables // Other non-thenables
...@@ -81,14 +82,14 @@ jQuery.extend( { ...@@ -81,14 +82,14 @@ jQuery.extend( {
jQuery.each( tuples, function( i, tuple ) { jQuery.each( tuples, function( i, tuple ) {
// Map tuples (progress, done, fail) to arguments (done, fail, progress) // Map tuples (progress, done, fail) to arguments (done, fail, progress)
var fn = jQuery.isFunction( fns[ tuple[ 4 ] ] ) && fns[ tuple[ 4 ] ]; var fn = isFunction( fns[ tuple[ 4 ] ] ) && fns[ tuple[ 4 ] ];
// deferred.progress(function() { bind to newDefer or newDefer.notify }) // deferred.progress(function() { bind to newDefer or newDefer.notify })
// deferred.done(function() { bind to newDefer or newDefer.resolve }) // deferred.done(function() { bind to newDefer or newDefer.resolve })
// deferred.fail(function() { bind to newDefer or newDefer.reject }) // deferred.fail(function() { bind to newDefer or newDefer.reject })
deferred[ tuple[ 1 ] ]( function() { deferred[ tuple[ 1 ] ]( function() {
var returned = fn && fn.apply( this, arguments ); var returned = fn && fn.apply( this, arguments );
if ( returned && jQuery.isFunction( returned.promise ) ) { if ( returned && isFunction( returned.promise ) ) {
returned.promise() returned.promise()
.progress( newDefer.notify ) .progress( newDefer.notify )
.done( newDefer.resolve ) .done( newDefer.resolve )
...@@ -142,7 +143,7 @@ jQuery.extend( { ...@@ -142,7 +143,7 @@ jQuery.extend( {
returned.then; returned.then;
// Handle a returned thenable // Handle a returned thenable
if ( jQuery.isFunction( then ) ) { if ( isFunction( then ) ) {
// Special processors (notify) just wait for resolution // Special processors (notify) just wait for resolution
if ( special ) { if ( special ) {
...@@ -238,7 +239,7 @@ jQuery.extend( { ...@@ -238,7 +239,7 @@ jQuery.extend( {
resolve( resolve(
0, 0,
newDefer, newDefer,
jQuery.isFunction( onProgress ) ? isFunction( onProgress ) ?
onProgress : onProgress :
Identity, Identity,
newDefer.notifyWith newDefer.notifyWith
...@@ -250,7 +251,7 @@ jQuery.extend( { ...@@ -250,7 +251,7 @@ jQuery.extend( {
resolve( resolve(
0, 0,
newDefer, newDefer,
jQuery.isFunction( onFulfilled ) ? isFunction( onFulfilled ) ?
onFulfilled : onFulfilled :
Identity Identity
) )
...@@ -261,7 +262,7 @@ jQuery.extend( { ...@@ -261,7 +262,7 @@ jQuery.extend( {
resolve( resolve(
0, 0,
newDefer, newDefer,
jQuery.isFunction( onRejected ) ? isFunction( onRejected ) ?
onRejected : onRejected :
Thrower Thrower
) )
...@@ -301,8 +302,15 @@ jQuery.extend( { ...@@ -301,8 +302,15 @@ jQuery.extend( {
// fulfilled_callbacks.disable // fulfilled_callbacks.disable
tuples[ 3 - i ][ 2 ].disable, tuples[ 3 - i ][ 2 ].disable,
// rejected_handlers.disable
// fulfilled_handlers.disable
tuples[ 3 - i ][ 3 ].disable,
// progress_callbacks.lock // progress_callbacks.lock
tuples[ 0 ][ 2 ].lock tuples[ 0 ][ 2 ].lock,
// progress_handlers.lock
tuples[ 0 ][ 3 ].lock
); );
} }
...@@ -372,7 +380,7 @@ jQuery.extend( { ...@@ -372,7 +380,7 @@ jQuery.extend( {
// 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" ||
jQuery.isFunction( resolveValues[ i ] && resolveValues[ i ].then ) ) { isFunction( resolveValues[ i ] && resolveValues[ i ].then ) ) {
return master.then(); return master.then();
} }
......
define( [ define( [
"./core", "./core",
"./core/nodeName" "./core/nodeName",
], function( jQuery, nodeName ) { "./core/camelCase",
"./core/toType",
"./var/isFunction",
"./var/isWindow",
"./var/slice",
"./event/alias"
], function( jQuery, nodeName, camelCase, toType, isFunction, isWindow, slice ) {
"use strict"; "use strict";
...@@ -26,6 +33,37 @@ jQuery.fn.extend( { ...@@ -26,6 +33,37 @@ jQuery.fn.extend( {
} }
} ); } );
// Bind a function to a context, optionally partially applying any
// arguments.
// jQuery.proxy is deprecated to promote standards (specifically Function#bind)
// However, it is not slated for removal any time soon
jQuery.proxy = function( fn, context ) {
var tmp, args, proxy;
if ( typeof context === "string" ) {
tmp = fn[ context ];
context = fn;
fn = tmp;
}
// Quick check to determine if target is callable, in the spec
// this throws a TypeError, but we will just return undefined.
if ( !isFunction( fn ) ) {
return undefined;
}
// Simulated bind
args = slice.call( arguments, 2 );
proxy = function() {
return fn.apply( context || this, args.concat( slice.call( arguments ) ) );
};
// Set the guid of unique handler to the same of original handler, so it can be removed
proxy.guid = fn.guid = fn.guid || jQuery.guid++;
return proxy;
};
jQuery.holdReady = function( hold ) { jQuery.holdReady = function( hold ) {
if ( hold ) { if ( hold ) {
jQuery.readyWait++; jQuery.readyWait++;
...@@ -36,5 +74,25 @@ jQuery.holdReady = function( hold ) { ...@@ -36,5 +74,25 @@ jQuery.holdReady = function( hold ) {
jQuery.isArray = Array.isArray; jQuery.isArray = Array.isArray;
jQuery.parseJSON = JSON.parse; jQuery.parseJSON = JSON.parse;
jQuery.nodeName = nodeName; jQuery.nodeName = nodeName;
jQuery.isFunction = isFunction;
jQuery.isWindow = isWindow;
jQuery.camelCase = camelCase;
jQuery.type = toType;
jQuery.now = Date.now;
jQuery.isNumeric = function( obj ) {
// As of jQuery 3.0, isNumeric is limited to
// strings and numbers (primitives or objects)
// that can be coerced to finite numbers (gh-2662)
var type = jQuery.type( obj );
return ( type === "number" || type === "string" ) &&
// parseFloat NaNs numeric-cast false positives ("")
// ...but misinterprets leading-number strings, particularly hex literals ("0x...")
// subtraction forces infinities to NaN
!isNaN( obj - parseFloat( obj ) );
};
} ); } );
define( [ define( [
"./core", "./core",
"./core/access", "./core/access",
"./var/isWindow",
"./css" "./css"
], function( jQuery, access ) { ], function( jQuery, access, isWindow ) {
"use strict"; "use strict";
...@@ -19,7 +20,7 @@ jQuery.each( { Height: "height", Width: "width" }, function( name, type ) { ...@@ -19,7 +20,7 @@ jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
return access( this, function( elem, type, value ) { return access( this, function( elem, type, value ) {
var doc; var doc;
if ( jQuery.isWindow( elem ) ) { if ( isWindow( elem ) ) {
// $( window ).outerWidth/Height return w/h including scrollbars (gh-1729) // $( window ).outerWidth/Height return w/h including scrollbars (gh-1729)
return funcName.indexOf( "outer" ) === 0 ? return funcName.indexOf( "outer" ) === 0 ?
......
define( [ define( [
"./core", "./core",
"./core/camelCase",
"./var/document", "./var/document",
"./var/isFunction",
"./var/rcssNum", "./var/rcssNum",
"./var/rnothtmlwhite", "./var/rnothtmlwhite",
"./css/var/cssExpand", "./css/var/cssExpand",
...@@ -17,8 +19,8 @@ define( [ ...@@ -17,8 +19,8 @@ define( [
"./manipulation", "./manipulation",
"./css", "./css",
"./effects/Tween" "./effects/Tween"
], function( jQuery, document, rcssNum, rnothtmlwhite, cssExpand, isHiddenWithinTree, swap, ], function( jQuery, camelCase, document, isFunction, rcssNum, rnothtmlwhite, cssExpand,
adjustCSS, dataPriv, showHide ) { isHiddenWithinTree, swap, adjustCSS, dataPriv, showHide ) {
"use strict"; "use strict";
...@@ -44,7 +46,7 @@ function createFxNow() { ...@@ -44,7 +46,7 @@ function createFxNow() {
window.setTimeout( function() { window.setTimeout( function() {
fxNow = undefined; fxNow = undefined;
} ); } );
return ( fxNow = jQuery.now() ); return ( fxNow = Date.now() );
} }
// Generate parameters to create a standard animation // Generate parameters to create a standard animation
...@@ -148,9 +150,10 @@ function defaultPrefilter( elem, props, opts ) { ...@@ -148,9 +150,10 @@ function defaultPrefilter( elem, props, opts ) {
// Restrict "overflow" and "display" styles during box animations // Restrict "overflow" and "display" styles during box animations
if ( isBox && elem.nodeType === 1 ) { if ( isBox && elem.nodeType === 1 ) {
// Support: IE <=9 - 11, Edge 12 - 13 // Support: IE <=9 - 11, Edge 12 - 15
// Record all 3 overflow attributes because IE does not infer the shorthand // Record all 3 overflow attributes because IE does not infer the shorthand
// from identically-valued overflowX and overflowY // from identically-valued overflowX and overflowY and Edge just mirrors
// the overflowX value there.
opts.overflow = [ style.overflow, style.overflowX, style.overflowY ]; opts.overflow = [ style.overflow, style.overflowX, style.overflowY ];
// Identify a display type, preferring old show/hide data over the CSS cascade // Identify a display type, preferring old show/hide data over the CSS cascade
...@@ -258,7 +261,7 @@ function propFilter( props, specialEasing ) { ...@@ -258,7 +261,7 @@ function propFilter( props, specialEasing ) {
// camelCase, specialEasing and expand cssHook pass // camelCase, specialEasing and expand cssHook pass
for ( index in props ) { for ( index in props ) {
name = jQuery.camelCase( index ); name = camelCase( index );
easing = specialEasing[ name ]; easing = specialEasing[ name ];
value = props[ index ]; value = props[ index ];
if ( Array.isArray( value ) ) { if ( Array.isArray( value ) ) {
...@@ -383,9 +386,9 @@ function Animation( elem, properties, options ) { ...@@ -383,9 +386,9 @@ function Animation( elem, properties, options ) {
for ( ; index < length; index++ ) { for ( ; index < length; index++ ) {
result = Animation.prefilters[ index ].call( animation, elem, props, animation.opts ); result = Animation.prefilters[ index ].call( animation, elem, props, animation.opts );
if ( result ) { if ( result ) {
if ( jQuery.isFunction( result.stop ) ) { if ( isFunction( result.stop ) ) {
jQuery._queueHooks( animation.elem, animation.opts.queue ).stop = jQuery._queueHooks( animation.elem, animation.opts.queue ).stop =
jQuery.proxy( result.stop, result ); result.stop.bind( result );
} }
return result; return result;
} }
...@@ -393,7 +396,7 @@ function Animation( elem, properties, options ) { ...@@ -393,7 +396,7 @@ function Animation( elem, properties, options ) {
jQuery.map( props, createTween, animation ); jQuery.map( props, createTween, animation );
if ( jQuery.isFunction( animation.opts.start ) ) { if ( isFunction( animation.opts.start ) ) {
animation.opts.start.call( elem, animation ); animation.opts.start.call( elem, animation );
} }
...@@ -426,7 +429,7 @@ jQuery.Animation = jQuery.extend( Animation, { ...@@ -426,7 +429,7 @@ jQuery.Animation = jQuery.extend( Animation, {
}, },
tweener: function( props, callback ) { tweener: function( props, callback ) {
if ( jQuery.isFunction( props ) ) { if ( isFunction( props ) ) {
callback = props; callback = props;
props = [ "*" ]; props = [ "*" ];
} else { } else {
...@@ -458,9 +461,9 @@ jQuery.Animation = jQuery.extend( Animation, { ...@@ -458,9 +461,9 @@ jQuery.Animation = jQuery.extend( Animation, {
jQuery.speed = function( speed, easing, fn ) { jQuery.speed = function( speed, easing, fn ) {
var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : { var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : {
complete: fn || !fn && easing || complete: fn || !fn && easing ||
jQuery.isFunction( speed ) && speed, isFunction( speed ) && speed,
duration: speed, duration: speed,
easing: fn && easing || easing && !jQuery.isFunction( easing ) && easing easing: fn && easing || easing && !isFunction( easing ) && easing
}; };
// Go to the end state if fx are off // Go to the end state if fx are off
...@@ -487,7 +490,7 @@ jQuery.speed = function( speed, easing, fn ) { ...@@ -487,7 +490,7 @@ jQuery.speed = function( speed, easing, fn ) {
opt.old = opt.complete; opt.old = opt.complete;
opt.complete = function() { opt.complete = function() {
if ( jQuery.isFunction( opt.old ) ) { if ( isFunction( opt.old ) ) {
opt.old.call( this ); opt.old.call( this );
} }
...@@ -651,7 +654,7 @@ jQuery.fx.tick = function() { ...@@ -651,7 +654,7 @@ jQuery.fx.tick = function() {
i = 0, i = 0,
timers = jQuery.timers; timers = jQuery.timers;
fxNow = jQuery.now(); fxNow = Date.now();
for ( ; i < timers.length; i++ ) { for ( ; i < timers.length; i++ ) {
timer = timers[ i ]; timer = timers[ i ];
......
...@@ -2,6 +2,7 @@ define( [ ...@@ -2,6 +2,7 @@ define( [
"./core", "./core",
"./var/document", "./var/document",
"./var/documentElement", "./var/documentElement",
"./var/isFunction",
"./var/rnothtmlwhite", "./var/rnothtmlwhite",
"./var/slice", "./var/slice",
"./data/var/dataPriv", "./data/var/dataPriv",
...@@ -9,7 +10,8 @@ define( [ ...@@ -9,7 +10,8 @@ define( [
"./core/init", "./core/init",
"./selector" "./selector"
], function( jQuery, document, documentElement, rnothtmlwhite, slice, dataPriv, nodeName ) { ], function( jQuery, document, documentElement, isFunction, rnothtmlwhite,
slice, dataPriv, nodeName ) {
"use strict"; "use strict";
...@@ -418,7 +420,7 @@ jQuery.event = { ...@@ -418,7 +420,7 @@ jQuery.event = {
enumerable: true, enumerable: true,
configurable: true, configurable: true,
get: jQuery.isFunction( hook ) ? get: isFunction( hook ) ?
function() { function() {
if ( this.originalEvent ) { if ( this.originalEvent ) {
return hook( this.originalEvent ); return hook( this.originalEvent );
...@@ -553,7 +555,7 @@ jQuery.Event = function( src, props ) { ...@@ -553,7 +555,7 @@ jQuery.Event = function( src, props ) {
} }
// Create a timestamp if incoming event doesn't have one // Create a timestamp if incoming event doesn't have one
this.timeStamp = src && src.timeStamp || jQuery.now(); this.timeStamp = src && src.timeStamp || Date.now();
// Mark it as fixed // Mark it as fixed
this[ jQuery.expando ] = true; this[ jQuery.expando ] = true;
......
...@@ -4,24 +4,28 @@ define( [ ...@@ -4,24 +4,28 @@ define( [
"../data/var/dataPriv", "../data/var/dataPriv",
"../data/var/acceptData", "../data/var/acceptData",
"../var/hasOwn", "../var/hasOwn",
"../var/isFunction",
"../var/isWindow",
"../event" "../event"
], function( jQuery, document, dataPriv, acceptData, hasOwn ) { ], function( jQuery, document, dataPriv, acceptData, hasOwn, isFunction, isWindow ) {
"use strict"; "use strict";
var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/; var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
stopPropagationCallback = function( e ) {
e.stopPropagation();
};
jQuery.extend( jQuery.event, { jQuery.extend( jQuery.event, {
trigger: function( event, data, elem, onlyHandlers ) { trigger: function( event, data, elem, onlyHandlers ) {
var i, cur, tmp, bubbleType, ontype, handle, special, var i, cur, tmp, bubbleType, ontype, handle, special, lastElement,
eventPath = [ elem || document ], eventPath = [ elem || document ],
type = hasOwn.call( event, "type" ) ? event.type : event, type = hasOwn.call( event, "type" ) ? event.type : event,
namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split( "." ) : []; namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split( "." ) : [];
cur = tmp = elem = elem || document; cur = lastElement = tmp = elem = elem || document;
// Don't do events on text and comment nodes // Don't do events on text and comment nodes
if ( elem.nodeType === 3 || elem.nodeType === 8 ) { if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
...@@ -73,7 +77,7 @@ jQuery.extend( jQuery.event, { ...@@ -73,7 +77,7 @@ jQuery.extend( jQuery.event, {
// Determine event propagation path in advance, per W3C events spec (#9951) // Determine event propagation path in advance, per W3C events spec (#9951)
// Bubble up to document, then to window; watch for a global ownerDocument var (#9724) // Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) { if ( !onlyHandlers && !special.noBubble && !isWindow( elem ) ) {
bubbleType = special.delegateType || type; bubbleType = special.delegateType || type;
if ( !rfocusMorph.test( bubbleType + type ) ) { if ( !rfocusMorph.test( bubbleType + type ) ) {
...@@ -93,7 +97,7 @@ jQuery.extend( jQuery.event, { ...@@ -93,7 +97,7 @@ jQuery.extend( jQuery.event, {
// Fire handlers on the event path // Fire handlers on the event path
i = 0; i = 0;
while ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped() ) { while ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped() ) {
lastElement = cur;
event.type = i > 1 ? event.type = i > 1 ?
bubbleType : bubbleType :
special.bindType || type; special.bindType || type;
...@@ -125,7 +129,7 @@ jQuery.extend( jQuery.event, { ...@@ -125,7 +129,7 @@ jQuery.extend( jQuery.event, {
// Call a native DOM method on the target with the same name as the event. // Call a native DOM method on the target with the same name as the event.
// Don't do default actions on window, that's where global variables be (#6170) // Don't do default actions on window, that's where global variables be (#6170)
if ( ontype && jQuery.isFunction( elem[ type ] ) && !jQuery.isWindow( elem ) ) { if ( ontype && isFunction( elem[ type ] ) && !isWindow( elem ) ) {
// Don't re-trigger an onFOO event when we call its FOO() method // Don't re-trigger an onFOO event when we call its FOO() method
tmp = elem[ ontype ]; tmp = elem[ ontype ];
...@@ -136,7 +140,17 @@ jQuery.extend( jQuery.event, { ...@@ -136,7 +140,17 @@ jQuery.extend( jQuery.event, {
// Prevent re-triggering of the same event, since we already bubbled it above // Prevent re-triggering of the same event, since we already bubbled it above
jQuery.event.triggered = type; jQuery.event.triggered = type;
if ( event.isPropagationStopped() ) {
lastElement.addEventListener( type, stopPropagationCallback );
}
elem[ type ](); elem[ type ]();
if ( event.isPropagationStopped() ) {
lastElement.removeEventListener( type, stopPropagationCallback );
}
jQuery.event.triggered = undefined; jQuery.event.triggered = undefined;
if ( tmp ) { if ( tmp ) {
......
...@@ -11,7 +11,6 @@ define( [ ...@@ -11,7 +11,6 @@ define( [
"./queue/delay", "./queue/delay",
"./attributes", "./attributes",
"./event", "./event",
"./event/alias",
"./event/focusin", "./event/focusin",
"./manipulation", "./manipulation",
"./manipulation/_evalUrl", "./manipulation/_evalUrl",
......
define( [ define( [
"./core", "./core",
"./var/concat", "./var/concat",
"./var/isFunction",
"./var/push", "./var/push",
"./core/access", "./core/access",
"./manipulation/var/rcheckableType", "./manipulation/var/rcheckableType",
...@@ -22,7 +23,7 @@ define( [ ...@@ -22,7 +23,7 @@ define( [
"./traversing", "./traversing",
"./selector", "./selector",
"./event" "./event"
], function( jQuery, concat, push, access, ], function( jQuery, concat, isFunction, push, access,
rcheckableType, rtagName, rscriptType, rcheckableType, rtagName, rscriptType,
wrapMap, getAll, setGlobalEval, buildFragment, support, wrapMap, getAll, setGlobalEval, buildFragment, support,
dataPriv, dataUser, acceptData, DOMEval, nodeName ) { dataPriv, dataUser, acceptData, DOMEval, nodeName ) {
...@@ -38,14 +39,13 @@ var ...@@ -38,14 +39,13 @@ var
/* eslint-enable */ /* eslint-enable */
// Support: IE <=10 - 11, Edge 12 - 13 // Support: IE <=10 - 11, Edge 12 - 13 only
// In IE/Edge using regex groups here causes severe slowdowns. // In IE/Edge using regex groups here causes severe slowdowns.
// See https://connect.microsoft.com/IE/feedback/details/1736512/ // See https://connect.microsoft.com/IE/feedback/details/1736512/
rnoInnerhtml = /<script|<style|<link/i, rnoInnerhtml = /<script|<style|<link/i,
// checked="checked" or checked // checked="checked" or checked
rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i, rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
rscriptTypeMasked = /^true\/(.*)/,
rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g; rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;
// Prefer a tbody over its parent table for containing new rows // Prefer a tbody over its parent table for containing new rows
...@@ -53,7 +53,7 @@ function manipulationTarget( elem, content ) { ...@@ -53,7 +53,7 @@ function manipulationTarget( elem, content ) {
if ( nodeName( elem, "table" ) && if ( nodeName( elem, "table" ) &&
nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ) { nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ) {
return jQuery( ">tbody", elem )[ 0 ] || elem; return jQuery( elem ).children( "tbody" )[ 0 ] || elem;
} }
return elem; return elem;
...@@ -65,10 +65,8 @@ function disableScript( elem ) { ...@@ -65,10 +65,8 @@ function disableScript( elem ) {
return elem; return elem;
} }
function restoreScript( elem ) { function restoreScript( elem ) {
var match = rscriptTypeMasked.exec( elem.type ); if ( ( elem.type || "" ).slice( 0, 5 ) === "true/" ) {
elem.type = elem.type.slice( 5 );
if ( match ) {
elem.type = match[ 1 ];
} else { } else {
elem.removeAttribute( "type" ); elem.removeAttribute( "type" );
} }
...@@ -134,15 +132,15 @@ function domManip( collection, args, callback, ignored ) { ...@@ -134,15 +132,15 @@ function domManip( collection, args, callback, ignored ) {
l = collection.length, l = collection.length,
iNoClone = l - 1, iNoClone = l - 1,
value = args[ 0 ], value = args[ 0 ],
isFunction = jQuery.isFunction( value ); valueIsFunction = isFunction( value );
// We can't cloneNode fragments that contain checked, in WebKit // We can't cloneNode fragments that contain checked, in WebKit
if ( isFunction || if ( valueIsFunction ||
( l > 1 && typeof value === "string" && ( l > 1 && typeof value === "string" &&
!support.checkClone && rchecked.test( value ) ) ) { !support.checkClone && rchecked.test( value ) ) ) {
return collection.each( function( index ) { return collection.each( function( index ) {
var self = collection.eq( index ); var self = collection.eq( index );
if ( isFunction ) { if ( valueIsFunction ) {
args[ 0 ] = value.call( this, index, self.html() ); args[ 0 ] = value.call( this, index, self.html() );
} }
domManip( self, args, callback, ignored ); domManip( self, args, callback, ignored );
...@@ -196,14 +194,14 @@ function domManip( collection, args, callback, ignored ) { ...@@ -196,14 +194,14 @@ function domManip( collection, args, callback, ignored ) {
!dataPriv.access( node, "globalEval" ) && !dataPriv.access( node, "globalEval" ) &&
jQuery.contains( doc, node ) ) { jQuery.contains( doc, node ) ) {
if ( node.src ) { if ( node.src && ( node.type || "" ).toLowerCase() !== "module" ) {
// Optional AJAX dependency, but won't run scripts if not present // Optional AJAX dependency, but won't run scripts if not present
if ( jQuery._evalUrl ) { if ( jQuery._evalUrl ) {
jQuery._evalUrl( node.src ); jQuery._evalUrl( node.src );
} }
} else { } else {
DOMEval( node.textContent.replace( rcleanScript, "" ), doc ); DOMEval( node.textContent.replace( rcleanScript, "" ), doc, node );
} }
} }
} }
......
define( [ define( [
"../core", "../core",
"../core/toType",
"./var/rtagName", "./var/rtagName",
"./var/rscriptType", "./var/rscriptType",
"./wrapMap", "./wrapMap",
"./getAll", "./getAll",
"./setGlobalEval" "./setGlobalEval"
], function( jQuery, rtagName, rscriptType, wrapMap, getAll, setGlobalEval ) { ], function( jQuery, toType, rtagName, rscriptType, wrapMap, getAll, setGlobalEval ) {
"use strict"; "use strict";
...@@ -24,7 +25,7 @@ function buildFragment( elems, context, scripts, selection, ignored ) { ...@@ -24,7 +25,7 @@ function buildFragment( elems, context, scripts, selection, ignored ) {
if ( elem || elem === 0 ) { if ( elem || elem === 0 ) {
// Add nodes directly // Add nodes directly
if ( jQuery.type( elem ) === "object" ) { if ( toType( elem ) === "object" ) {
// Support: Android <=4.0 only, PhantomJS 1 only // Support: Android <=4.0 only, PhantomJS 1 only
// push.apply(_, arraylike) throws on ancient WebKit // push.apply(_, arraylike) throws on ancient WebKit
......
define( function() { define( function() {
"use strict"; "use strict";
return ( /^$|\/(?:java|ecma)script/i ); return ( /^$|^module$|\/(?:java|ecma)script/i );
} ); } );
This diff is collapsed.
define( [ define( [
"./core", "./core",
"./core/toType",
"./manipulation/var/rcheckableType", "./manipulation/var/rcheckableType",
"./var/isFunction",
"./core/init", "./core/init",
"./traversing", // filter "./traversing", // filter
"./attributes/prop" "./attributes/prop"
], function( jQuery, rcheckableType ) { ], function( jQuery, toType, rcheckableType, isFunction ) {
"use strict"; "use strict";
...@@ -38,7 +40,7 @@ function buildParams( prefix, obj, traditional, add ) { ...@@ -38,7 +40,7 @@ function buildParams( prefix, obj, traditional, add ) {
} }
} ); } );
} else if ( !traditional && jQuery.type( obj ) === "object" ) { } else if ( !traditional && toType( obj ) === "object" ) {
// Serialize object item. // Serialize object item.
for ( name in obj ) { for ( name in obj ) {
...@@ -60,7 +62,7 @@ jQuery.param = function( a, traditional ) { ...@@ -60,7 +62,7 @@ jQuery.param = function( a, traditional ) {
add = function( key, valueOrFunction ) { add = function( key, valueOrFunction ) {
// If value is a function, invoke it and use its return value // If value is a function, invoke it and use its return value
var value = jQuery.isFunction( valueOrFunction ) ? var value = isFunction( valueOrFunction ) ?
valueOrFunction() : valueOrFunction() :
valueOrFunction; valueOrFunction;
......
define( [ define( [
"../core", "../core",
"../var/indexOf", "../var/indexOf",
"../var/isFunction",
"./var/rneedsContext", "./var/rneedsContext",
"../selector" "../selector"
], function( jQuery, indexOf, rneedsContext ) { ], function( jQuery, indexOf, isFunction, rneedsContext ) {
"use strict"; "use strict";
var risSimple = /^.[^:#\[\.,]*$/;
// Implement the identical functionality for filter and not // Implement the identical functionality for filter and not
function winnow( elements, qualifier, not ) { function winnow( elements, qualifier, not ) {
if ( jQuery.isFunction( qualifier ) ) { if ( isFunction( qualifier ) ) {
return jQuery.grep( elements, function( elem, i ) { return jQuery.grep( elements, function( elem, i ) {
return !!qualifier.call( elem, i, elem ) !== not; return !!qualifier.call( elem, i, elem ) !== not;
} ); } );
...@@ -31,16 +30,8 @@ function winnow( elements, qualifier, not ) { ...@@ -31,16 +30,8 @@ function winnow( elements, qualifier, not ) {
} ); } );
} }
// Simple selector that can be filtered directly, removing non-Elements // Filtered directly for both simple and complex selectors
if ( risSimple.test( qualifier ) ) { return jQuery.filter( qualifier, elements, not );
return jQuery.filter( qualifier, elements, not );
}
// Complex selector, compare the two sets, removing non-Elements
qualifier = jQuery.filter( qualifier, elements );
return jQuery.grep( elements, function( elem ) {
return ( indexOf.call( qualifier, elem ) > -1 ) !== not && elem.nodeType === 1;
} );
} }
jQuery.filter = function( expr, elems, not ) { jQuery.filter = function( expr, elems, not ) {
......
define( function() {
"use strict";
return function isFunction( obj ) {
// Support: Chrome <=57, Firefox <=52
// In some browsers, typeof returns "function" for HTML <object> elements
// (i.e., `typeof document.createElement( "object" ) === "function"`).
// We don't want to classify *any* DOM node as a function.
return typeof obj === "function" && typeof obj.nodeType !== "number";
};
} );
This diff is collapsed.
This diff is collapsed.
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