mirror of
https://github.com/jquery/jquery.git
synced 2024-11-23 02:54:22 +00:00
Core: Drop support for IE <11, iOS <11, Firefox <65, Android Browser & PhantomJS
Also, update support comments format to match format described in: https://github.com/jquery/contribute.jquery.org/issues/95#issuecomment-69379197 with the change from: https://github.com/jquery/contribute.jquery.org/issues/95#issuecomment-448998379 (open-ended ranges end with `+`). Fixes gh-3950 Fixes gh-4299 Closes gh-4347
This commit is contained in:
parent
bde53edcf4
commit
cf84696fd1
@ -3,11 +3,8 @@
|
|||||||
|
|
||||||
"extends": "jquery",
|
"extends": "jquery",
|
||||||
|
|
||||||
// Support: IE <=9 only, Android <=4.0 only
|
|
||||||
// The above browsers are failing a lot of tests in the ES5
|
|
||||||
// test suite at http://test262.ecmascript.org.
|
|
||||||
"parserOptions": {
|
"parserOptions": {
|
||||||
"ecmaVersion": 3
|
"ecmaVersion": 5
|
||||||
},
|
},
|
||||||
|
|
||||||
// The browser env is not enabled on purpose so that code takes
|
// The browser env is not enabled on purpose so that code takes
|
||||||
|
43
Gruntfile.js
43
Gruntfile.js
@ -14,15 +14,7 @@ module.exports = function( grunt ) {
|
|||||||
|
|
||||||
var fs = require( "fs" ),
|
var fs = require( "fs" ),
|
||||||
gzip = require( "gzip-js" ),
|
gzip = require( "gzip-js" ),
|
||||||
isTravis = process.env.TRAVIS,
|
isTravis = process.env.TRAVIS;
|
||||||
oldNode = /^v6\./.test( process.version );
|
|
||||||
|
|
||||||
// Support: Node.js <8
|
|
||||||
// Skip running tasks that dropped support for Node.js 6
|
|
||||||
// in those Node versions.
|
|
||||||
function runIfNewNode( task ) {
|
|
||||||
return oldNode ? "print_old_node_message:" + task : task;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( !grunt.option( "filename" ) ) {
|
if ( !grunt.option( "filename" ) ) {
|
||||||
grunt.option( "filename", "jquery.js" );
|
grunt.option( "filename", "jquery.js" );
|
||||||
@ -123,10 +115,9 @@ module.exports = function( grunt ) {
|
|||||||
testswarm: {
|
testswarm: {
|
||||||
tests: [
|
tests: [
|
||||||
|
|
||||||
// A special module with basic tests, meant for
|
// A special module with basic tests, meant for not fully
|
||||||
// not fully supported environments like Android 2.3,
|
// supported environments like jsdom. We run it everywhere,
|
||||||
// jsdom or PhantomJS. We run it everywhere, though,
|
// though, to make sure tests are not broken.
|
||||||
// to make sure tests are not broken.
|
|
||||||
"basic",
|
"basic",
|
||||||
|
|
||||||
"ajax",
|
"ajax",
|
||||||
@ -291,23 +282,13 @@ module.exports = function( grunt ) {
|
|||||||
"dist/<%= grunt.option('filename').replace('.js', '.min.map') %>",
|
"dist/<%= grunt.option('filename').replace('.js', '.min.map') %>",
|
||||||
report: "min",
|
report: "min",
|
||||||
output: {
|
output: {
|
||||||
"ascii_only": true,
|
"ascii_only": true
|
||||||
|
|
||||||
// Support: Android 4.0 only
|
|
||||||
// UglifyJS 3 breaks Android 4.0 if this option is not enabled.
|
|
||||||
// This is in lieu of setting ie8 for all of mangle, compress, and output
|
|
||||||
"ie8": true
|
|
||||||
},
|
},
|
||||||
banner: "/*! jQuery v<%= pkg.version %> | " +
|
banner: "/*! jQuery v<%= pkg.version %> | " +
|
||||||
"(c) JS Foundation and other contributors | jquery.org/license */",
|
"(c) JS Foundation and other contributors | jquery.org/license */",
|
||||||
compress: {
|
compress: {
|
||||||
"hoist_funs": false,
|
"hoist_funs": false,
|
||||||
loops: false,
|
loops: false
|
||||||
|
|
||||||
// Support: IE <11
|
|
||||||
// typeofs transformation is unsafe for IE9-10
|
|
||||||
// See https://github.com/mishoo/UglifyJS2/issues/2198
|
|
||||||
typeofs: false
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -320,13 +301,6 @@ module.exports = function( grunt ) {
|
|||||||
// Integrate jQuery specific tasks
|
// Integrate jQuery specific tasks
|
||||||
grunt.loadTasks( "build/tasks" );
|
grunt.loadTasks( "build/tasks" );
|
||||||
|
|
||||||
// Support: Node.js <8
|
|
||||||
// Print a message on Node.js <8 notifying the task is skipped there.
|
|
||||||
grunt.registerTask( "print_old_node_message", function() {
|
|
||||||
var task = [].slice.call( arguments ).join( ":" );
|
|
||||||
grunt.log.writeln( "Old Node.js detected, running the task \"" + task + "\" skipped..." );
|
|
||||||
} );
|
|
||||||
|
|
||||||
grunt.registerTask( "lint", [
|
grunt.registerTask( "lint", [
|
||||||
"jsonlint",
|
"jsonlint",
|
||||||
|
|
||||||
@ -349,10 +323,7 @@ module.exports = function( grunt ) {
|
|||||||
grunt.registerTask( "test:fast", "node_smoke_tests" );
|
grunt.registerTask( "test:fast", "node_smoke_tests" );
|
||||||
grunt.registerTask( "test:slow", [
|
grunt.registerTask( "test:slow", [
|
||||||
"promises_aplus_tests",
|
"promises_aplus_tests",
|
||||||
|
"karma:jsdom"
|
||||||
// Support: Node.js <8
|
|
||||||
// Karma no longer supports Node.js <8 as it relies on async-await internally.
|
|
||||||
runIfNewNode( "karma:jsdom" )
|
|
||||||
] );
|
] );
|
||||||
|
|
||||||
grunt.registerTask( "test", [
|
grunt.registerTask( "test", [
|
||||||
|
11
src/ajax.js
11
src/ajax.js
@ -1,7 +1,6 @@
|
|||||||
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",
|
||||||
@ -12,7 +11,7 @@ define( [
|
|||||||
"./event/trigger",
|
"./event/trigger",
|
||||||
"./deferred",
|
"./deferred",
|
||||||
"./serialize" // jQuery.param
|
"./serialize" // jQuery.param
|
||||||
], function( jQuery, document, isFunction, rnothtmlwhite, location, nonce, rquery ) {
|
], function( jQuery, document, rnothtmlwhite, location, nonce, rquery ) {
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
@ -67,7 +66,7 @@ function addToPrefiltersOrTransports( structure ) {
|
|||||||
i = 0,
|
i = 0,
|
||||||
dataTypes = dataTypeExpression.toLowerCase().match( rnothtmlwhite ) || [];
|
dataTypes = dataTypeExpression.toLowerCase().match( rnothtmlwhite ) || [];
|
||||||
|
|
||||||
if ( isFunction( func ) ) {
|
if ( typeof func === "function" ) {
|
||||||
|
|
||||||
// For each dataType in the dataTypeExpression
|
// For each dataType in the dataTypeExpression
|
||||||
while ( ( dataType = dataTypes[ i++ ] ) ) {
|
while ( ( dataType = dataTypes[ i++ ] ) ) {
|
||||||
@ -541,13 +540,13 @@ jQuery.extend( {
|
|||||||
if ( s.crossDomain == null ) {
|
if ( s.crossDomain == null ) {
|
||||||
urlAnchor = document.createElement( "a" );
|
urlAnchor = document.createElement( "a" );
|
||||||
|
|
||||||
// Support: IE <=8 - 11, Edge 12 - 15
|
// Support: IE <=8 - 11+, Edge 12 - 17 only
|
||||||
// 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 {
|
||||||
urlAnchor.href = s.url;
|
urlAnchor.href = s.url;
|
||||||
|
|
||||||
// Support: IE <=8 - 11 only
|
// Support: IE <=8 - 11+
|
||||||
// Anchor's host property isn't correctly set when s.url is relative
|
// Anchor's host property isn't correctly set when s.url is relative
|
||||||
urlAnchor.href = urlAnchor.href;
|
urlAnchor.href = urlAnchor.href;
|
||||||
s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !==
|
s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !==
|
||||||
@ -837,7 +836,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 ( isFunction( data ) ) {
|
if ( typeof data === "function" ) {
|
||||||
type = type || callback;
|
type = type || callback;
|
||||||
callback = data;
|
callback = data;
|
||||||
data = undefined;
|
data = undefined;
|
||||||
|
@ -1,10 +1,9 @@
|
|||||||
define( [
|
define( [
|
||||||
"../core",
|
"../core",
|
||||||
"../var/isFunction",
|
|
||||||
"./var/nonce",
|
"./var/nonce",
|
||||||
"./var/rquery",
|
"./var/rquery",
|
||||||
"../ajax"
|
"../ajax"
|
||||||
], function( jQuery, isFunction, nonce, rquery ) {
|
], function( jQuery, nonce, rquery ) {
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
@ -37,7 +36,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 = isFunction( s.jsonpCallback ) ?
|
callbackName = s.jsonpCallback = typeof s.jsonpCallback === "function" ?
|
||||||
s.jsonpCallback() :
|
s.jsonpCallback() :
|
||||||
s.jsonpCallback;
|
s.jsonpCallback;
|
||||||
|
|
||||||
@ -88,7 +87,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 && isFunction( overwritten ) ) {
|
if ( responseContainer && typeof overwritten === "function" ) {
|
||||||
overwritten( responseContainer[ 0 ] );
|
overwritten( responseContainer[ 0 ] );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,13 +1,12 @@
|
|||||||
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, isFunction ) {
|
], function( jQuery, stripAndCollapse ) {
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
@ -25,7 +24,7 @@ jQuery.fn.load = function( url, params, callback ) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// If it's a function
|
// If it's a function
|
||||||
if ( isFunction( params ) ) {
|
if ( typeof params === "function" ) {
|
||||||
|
|
||||||
// We assume that it's the callback
|
// We assume that it's the callback
|
||||||
callback = params;
|
callback = params;
|
||||||
|
@ -11,7 +11,7 @@ jQuery.parseXML = function( data ) {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Support: IE 9 - 11 only
|
// Support: IE 9 - 11+
|
||||||
// IE throws on parseFromString with invalid input.
|
// IE throws on parseFromString with invalid input.
|
||||||
try {
|
try {
|
||||||
xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" );
|
xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" );
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
define( [
|
define( [
|
||||||
"../core",
|
"../core",
|
||||||
"../var/support",
|
|
||||||
"../ajax"
|
"../ajax"
|
||||||
], function( jQuery, support ) {
|
], function( jQuery ) {
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
@ -15,22 +14,13 @@ jQuery.ajaxSettings.xhr = function() {
|
|||||||
var xhrSuccessStatus = {
|
var xhrSuccessStatus = {
|
||||||
|
|
||||||
// File protocol always yields status code 0, assume 200
|
// File protocol always yields status code 0, assume 200
|
||||||
0: 200,
|
0: 200
|
||||||
|
};
|
||||||
// Support: IE <=9 only
|
|
||||||
// #1450: sometimes IE returns 1223 when it should be 204
|
|
||||||
1223: 204
|
|
||||||
},
|
|
||||||
xhrSupported = jQuery.ajaxSettings.xhr();
|
|
||||||
|
|
||||||
support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported );
|
|
||||||
support.ajax = xhrSupported = !!xhrSupported;
|
|
||||||
|
|
||||||
jQuery.ajaxTransport( function( options ) {
|
jQuery.ajaxTransport( function( options ) {
|
||||||
var callback, errorCallback;
|
var callback;
|
||||||
|
|
||||||
// Cross domain only allowed if supported through XMLHttpRequest
|
// Cross domain only allowed if supported through XMLHttpRequest
|
||||||
if ( support.cors || xhrSupported && !options.crossDomain ) {
|
|
||||||
return {
|
return {
|
||||||
send: function( headers, complete ) {
|
send: function( headers, complete ) {
|
||||||
var i,
|
var i,
|
||||||
@ -74,39 +64,26 @@ jQuery.ajaxTransport( function( options ) {
|
|||||||
callback = function( type ) {
|
callback = function( type ) {
|
||||||
return function() {
|
return function() {
|
||||||
if ( callback ) {
|
if ( callback ) {
|
||||||
callback = errorCallback = xhr.onload =
|
callback = xhr.onload = xhr.onerror = xhr.onabort = xhr.ontimeout = null;
|
||||||
xhr.onerror = xhr.onabort = xhr.ontimeout =
|
|
||||||
xhr.onreadystatechange = null;
|
|
||||||
|
|
||||||
if ( type === "abort" ) {
|
if ( type === "abort" ) {
|
||||||
xhr.abort();
|
xhr.abort();
|
||||||
} else if ( type === "error" ) {
|
} else if ( type === "error" ) {
|
||||||
|
|
||||||
// Support: IE <=9 only
|
|
||||||
// On a manual native abort, IE9 throws
|
|
||||||
// errors on any property access that is not readyState
|
|
||||||
if ( typeof xhr.status !== "number" ) {
|
|
||||||
complete( 0, "error" );
|
|
||||||
} else {
|
|
||||||
complete(
|
complete(
|
||||||
|
|
||||||
// File: protocol always yields status 0; see #8605, #14207
|
// File: protocol always yields status 0; see #8605, #14207
|
||||||
xhr.status,
|
xhr.status,
|
||||||
xhr.statusText
|
xhr.statusText
|
||||||
);
|
);
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
complete(
|
complete(
|
||||||
xhrSuccessStatus[ xhr.status ] || xhr.status,
|
xhrSuccessStatus[ xhr.status ] || xhr.status,
|
||||||
xhr.statusText,
|
xhr.statusText,
|
||||||
|
|
||||||
// Support: IE <=9 only
|
|
||||||
// IE9 has no XHR2 but throws on binary (trac-11426)
|
|
||||||
// For XHR2 non-text, let the caller handle it (gh-2498)
|
// For XHR2 non-text, let the caller handle it (gh-2498)
|
||||||
( xhr.responseType || "text" ) !== "text" ||
|
( xhr.responseType || "text" ) === "text" ?
|
||||||
typeof xhr.responseText !== "string" ?
|
{ text: xhr.responseText } :
|
||||||
{ binary: xhr.response } :
|
{ binary: xhr.response },
|
||||||
{ text: xhr.responseText },
|
|
||||||
xhr.getAllResponseHeaders()
|
xhr.getAllResponseHeaders()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -116,31 +93,7 @@ jQuery.ajaxTransport( function( options ) {
|
|||||||
|
|
||||||
// Listen to events
|
// Listen to events
|
||||||
xhr.onload = callback();
|
xhr.onload = callback();
|
||||||
errorCallback = xhr.onerror = xhr.ontimeout = callback( "error" );
|
xhr.onabort = xhr.onerror = xhr.ontimeout = callback( "error" );
|
||||||
|
|
||||||
// Support: IE 9 only
|
|
||||||
// Use onreadystatechange to replace onabort
|
|
||||||
// to handle uncaught aborts
|
|
||||||
if ( xhr.onabort !== undefined ) {
|
|
||||||
xhr.onabort = errorCallback;
|
|
||||||
} else {
|
|
||||||
xhr.onreadystatechange = function() {
|
|
||||||
|
|
||||||
// Check readyState before timeout as it changes
|
|
||||||
if ( xhr.readyState === 4 ) {
|
|
||||||
|
|
||||||
// Allow onerror to be called first,
|
|
||||||
// but that will not handle a native abort
|
|
||||||
// Also, save errorCallback to a variable
|
|
||||||
// as xhr.onerror cannot be accessed
|
|
||||||
window.setTimeout( function() {
|
|
||||||
if ( callback ) {
|
|
||||||
errorCallback();
|
|
||||||
}
|
|
||||||
} );
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
// Create the abort callback
|
// Create the abort callback
|
||||||
callback = callback( "abort" );
|
callback = callback( "abort" );
|
||||||
@ -164,7 +117,6 @@ jQuery.ajaxTransport( function( options ) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
|
||||||
} );
|
} );
|
||||||
|
|
||||||
} );
|
} );
|
||||||
|
@ -1,11 +1,10 @@
|
|||||||
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, isFunction, rnothtmlwhite, dataPriv ) {
|
], function( jQuery, stripAndCollapse, rnothtmlwhite, dataPriv ) {
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
@ -28,7 +27,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 ( isFunction( value ) ) {
|
if ( typeof value === "function" ) {
|
||||||
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 ) ) );
|
||||||
} );
|
} );
|
||||||
@ -65,7 +64,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 ( isFunction( value ) ) {
|
if ( typeof value === "function" ) {
|
||||||
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 ) ) );
|
||||||
} );
|
} );
|
||||||
@ -114,7 +113,7 @@ jQuery.fn.extend( {
|
|||||||
return stateVal ? this.addClass( value ) : this.removeClass( value );
|
return stateVal ? this.addClass( value ) : this.removeClass( value );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( isFunction( value ) ) {
|
if ( typeof value === "function" ) {
|
||||||
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 ),
|
||||||
|
@ -59,7 +59,7 @@ jQuery.extend( {
|
|||||||
tabIndex: {
|
tabIndex: {
|
||||||
get: function( elem ) {
|
get: function( elem ) {
|
||||||
|
|
||||||
// Support: IE <=9 - 11 only
|
// Support: IE <=9 - 11+
|
||||||
// elem.tabIndex doesn't always return the
|
// elem.tabIndex doesn't always return the
|
||||||
// correct value when it hasn't been explicitly set
|
// correct value when it hasn't been explicitly set
|
||||||
// https://web.archive.org/web/20141116233347/http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
|
// https://web.archive.org/web/20141116233347/http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
|
||||||
@ -89,7 +89,7 @@ jQuery.extend( {
|
|||||||
}
|
}
|
||||||
} );
|
} );
|
||||||
|
|
||||||
// Support: IE <=11 only
|
// Support: IE <=11+
|
||||||
// Accessing the selectedIndex property
|
// Accessing the selectedIndex property
|
||||||
// forces the browser to respect setting selected
|
// forces the browser to respect setting selected
|
||||||
// on the option
|
// on the option
|
||||||
@ -101,23 +101,23 @@ if ( !support.optSelected ) {
|
|||||||
jQuery.propHooks.selected = {
|
jQuery.propHooks.selected = {
|
||||||
get: function( elem ) {
|
get: function( elem ) {
|
||||||
|
|
||||||
/* eslint no-unused-expressions: "off" */
|
|
||||||
|
|
||||||
var parent = elem.parentNode;
|
var parent = elem.parentNode;
|
||||||
if ( parent && parent.parentNode ) {
|
if ( parent && parent.parentNode ) {
|
||||||
|
// eslint-disable-next-line no-unused-expressions
|
||||||
parent.parentNode.selectedIndex;
|
parent.parentNode.selectedIndex;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
},
|
},
|
||||||
set: function( elem ) {
|
set: function( elem ) {
|
||||||
|
|
||||||
/* eslint no-unused-expressions: "off" */
|
|
||||||
|
|
||||||
var parent = elem.parentNode;
|
var parent = elem.parentNode;
|
||||||
if ( parent ) {
|
if ( parent ) {
|
||||||
|
// eslint-disable-next-line no-unused-expressions
|
||||||
parent.selectedIndex;
|
parent.selectedIndex;
|
||||||
|
|
||||||
if ( parent.parentNode ) {
|
if ( parent.parentNode ) {
|
||||||
|
// eslint-disable-next-line no-unused-expressions
|
||||||
parent.parentNode.selectedIndex;
|
parent.parentNode.selectedIndex;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,15 +12,11 @@ define( [
|
|||||||
|
|
||||||
input.type = "checkbox";
|
input.type = "checkbox";
|
||||||
|
|
||||||
// Support: Android <=4.3 only
|
// Support: IE <=11+
|
||||||
// Default value for a checkbox should be "on"
|
|
||||||
support.checkOn = input.value !== "";
|
|
||||||
|
|
||||||
// Support: IE <=11 only
|
|
||||||
// Must access selectedIndex to make default options select
|
// Must access selectedIndex to make default options select
|
||||||
support.optSelected = opt.selected;
|
support.optSelected = opt.selected;
|
||||||
|
|
||||||
// Support: IE <=11 only
|
// Support: IE <=11+
|
||||||
// An input loses its value after becoming a radio
|
// An input loses its value after becoming a radio
|
||||||
input = document.createElement( "input" );
|
input = document.createElement( "input" );
|
||||||
input.value = "t";
|
input.value = "t";
|
||||||
|
@ -1,12 +1,10 @@
|
|||||||
define( [
|
define( [
|
||||||
"../core",
|
"../core",
|
||||||
"../core/stripAndCollapse",
|
"../core/stripAndCollapse",
|
||||||
"./support",
|
|
||||||
"../core/nodeName",
|
"../core/nodeName",
|
||||||
"../var/isFunction",
|
|
||||||
|
|
||||||
"../core/init"
|
"../core/init"
|
||||||
], function( jQuery, stripAndCollapse, support, nodeName, isFunction ) {
|
], function( jQuery, stripAndCollapse, nodeName ) {
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
@ -43,7 +41,7 @@ jQuery.fn.extend( {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
valueIsFunction = isFunction( value );
|
valueIsFunction = typeof value === "function";
|
||||||
|
|
||||||
return this.each( function( i ) {
|
return this.each( function( i ) {
|
||||||
var val;
|
var val;
|
||||||
@ -90,7 +88,7 @@ jQuery.extend( {
|
|||||||
return val != null ?
|
return val != null ?
|
||||||
val :
|
val :
|
||||||
|
|
||||||
// Support: IE <=10 - 11 only
|
// Support: IE <=10 - 11+
|
||||||
// option.text throws exceptions (#14686, #14858)
|
// option.text throws exceptions (#14686, #14858)
|
||||||
// Strip and collapse whitespace
|
// Strip and collapse whitespace
|
||||||
// https://html.spec.whatwg.org/#strip-and-collapse-whitespace
|
// https://html.spec.whatwg.org/#strip-and-collapse-whitespace
|
||||||
@ -117,9 +115,7 @@ jQuery.extend( {
|
|||||||
for ( ; i < max; i++ ) {
|
for ( ; i < max; i++ ) {
|
||||||
option = options[ i ];
|
option = options[ i ];
|
||||||
|
|
||||||
// Support: IE <=9 only
|
if ( option.selected &&
|
||||||
// IE8-9 doesn't update selected after form reset (#2551)
|
|
||||||
if ( ( option.selected || i === index ) &&
|
|
||||||
|
|
||||||
// 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 &&
|
||||||
@ -181,11 +177,6 @@ jQuery.each( [ "radio", "checkbox" ], function() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
if ( !support.checkOn ) {
|
|
||||||
jQuery.valHooks[ this ].get = function( elem ) {
|
|
||||||
return elem.getAttribute( "value" ) === null ? "on" : elem.value;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
} );
|
} );
|
||||||
|
|
||||||
} );
|
} );
|
||||||
|
@ -1,9 +1,8 @@
|
|||||||
define( [
|
define( [
|
||||||
"./core",
|
"./core",
|
||||||
"./core/toType",
|
"./core/toType",
|
||||||
"./var/isFunction",
|
|
||||||
"./var/rnothtmlwhite"
|
"./var/rnothtmlwhite"
|
||||||
], function( jQuery, toType, isFunction, rnothtmlwhite ) {
|
], function( jQuery, toType, rnothtmlwhite ) {
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
@ -127,7 +126,7 @@ jQuery.Callbacks = function( options ) {
|
|||||||
|
|
||||||
( function add( args ) {
|
( function add( args ) {
|
||||||
jQuery.each( args, function( _, arg ) {
|
jQuery.each( args, function( _, arg ) {
|
||||||
if ( isFunction( arg ) ) {
|
if ( typeof arg === "function" ) {
|
||||||
if ( !options.unique || !self.has( arg ) ) {
|
if ( !options.unique || !self.has( arg ) ) {
|
||||||
list.push( arg );
|
list.push( arg );
|
||||||
}
|
}
|
||||||
|
27
src/core.js
27
src/core.js
@ -15,14 +15,14 @@ define( [
|
|||||||
"./var/hasOwn",
|
"./var/hasOwn",
|
||||||
"./var/fnToString",
|
"./var/fnToString",
|
||||||
"./var/ObjectFunctionString",
|
"./var/ObjectFunctionString",
|
||||||
|
"./var/trim",
|
||||||
"./var/support",
|
"./var/support",
|
||||||
"./var/isFunction",
|
|
||||||
"./var/isWindow",
|
"./var/isWindow",
|
||||||
"./core/DOMEval",
|
"./core/DOMEval",
|
||||||
"./core/toType"
|
"./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, isFunction, isWindow, DOMEval, toType ) {
|
trim, support, isWindow, DOMEval, toType ) {
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
@ -35,11 +35,7 @@ var
|
|||||||
// The jQuery object is actually just the init constructor 'enhanced'
|
// The jQuery object is actually just the init constructor 'enhanced'
|
||||||
// Need init if jQuery is called (just allow error to be thrown if not included)
|
// Need init if jQuery is called (just allow error to be thrown if not included)
|
||||||
return new jQuery.fn.init( selector, context );
|
return new jQuery.fn.init( selector, context );
|
||||||
},
|
};
|
||||||
|
|
||||||
// Support: Android <=4.0 only
|
|
||||||
// Make sure we trim BOM and NBSP
|
|
||||||
rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;
|
|
||||||
|
|
||||||
jQuery.fn = jQuery.prototype = {
|
jQuery.fn = jQuery.prototype = {
|
||||||
|
|
||||||
@ -139,7 +135,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" && !isFunction( target ) ) {
|
if ( typeof target !== "object" && typeof target !== "function" ) {
|
||||||
target = {};
|
target = {};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -264,11 +260,8 @@ jQuery.extend( {
|
|||||||
return obj;
|
return obj;
|
||||||
},
|
},
|
||||||
|
|
||||||
// Support: Android <=4.0 only
|
|
||||||
trim: function( text ) {
|
trim: function( text ) {
|
||||||
return text == null ?
|
return text == null ? "" : trim.call( text );
|
||||||
"" :
|
|
||||||
( text + "" ).replace( rtrim, "" );
|
|
||||||
},
|
},
|
||||||
|
|
||||||
// results is for internal usage only
|
// results is for internal usage only
|
||||||
@ -293,8 +286,6 @@ jQuery.extend( {
|
|||||||
return arr == null ? -1 : indexOf.call( arr, elem, i );
|
return arr == null ? -1 : indexOf.call( arr, elem, i );
|
||||||
},
|
},
|
||||||
|
|
||||||
// Support: Android <=4.0 only, PhantomJS 1 only
|
|
||||||
// push.apply(_, arraylike) throws on ancient WebKit
|
|
||||||
merge: function( first, second ) {
|
merge: function( first, second ) {
|
||||||
var len = +second.length,
|
var len = +second.length,
|
||||||
j = 0,
|
j = 0,
|
||||||
@ -380,14 +371,10 @@ function( i, name ) {
|
|||||||
|
|
||||||
function isArrayLike( obj ) {
|
function isArrayLike( obj ) {
|
||||||
|
|
||||||
// Support: real iOS 8.2 only (not reproducible in simulator)
|
var length = !!obj && obj.length,
|
||||||
// `in` check used to prevent JIT error (gh-2145)
|
|
||||||
// hasOwn isn't used here due to false negatives
|
|
||||||
// regarding Nodelist length in IE
|
|
||||||
var length = !!obj && "length" in obj && obj.length,
|
|
||||||
type = toType( obj );
|
type = toType( obj );
|
||||||
|
|
||||||
if ( isFunction( obj ) || isWindow( obj ) ) {
|
if ( typeof obj === "function" || isWindow( obj ) ) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ define( [
|
|||||||
if ( node ) {
|
if ( node ) {
|
||||||
for ( i in preservedScriptAttributes ) {
|
for ( i in preservedScriptAttributes ) {
|
||||||
|
|
||||||
// Support: Firefox 64+, Edge 18+
|
// Support: Firefox <=64 - 66+, Edge <=18+
|
||||||
// Some browsers don't support the "nonce" property on scripts.
|
// Some browsers don't support the "nonce" property on scripts.
|
||||||
// On the other hand, just using `getAttribute` is not enough as
|
// On the other hand, just using `getAttribute` is not enough as
|
||||||
// the `nonce` attribute is reset to an empty string whenever it
|
// the `nonce` attribute is reset to an empty string whenever it
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
define( [
|
define( [
|
||||||
"../core",
|
"../core",
|
||||||
"../core/toType",
|
"../core/toType"
|
||||||
"../var/isFunction"
|
], function( jQuery, toType ) {
|
||||||
], function( jQuery, toType, isFunction ) {
|
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
@ -24,7 +23,7 @@ var access = function( elems, fn, key, value, chainable, emptyGet, raw ) {
|
|||||||
} else if ( value !== undefined ) {
|
} else if ( value !== undefined ) {
|
||||||
chainable = true;
|
chainable = true;
|
||||||
|
|
||||||
if ( !isFunction( value ) ) {
|
if ( typeof value !== "function" ) {
|
||||||
raw = true;
|
raw = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,11 +2,10 @@
|
|||||||
define( [
|
define( [
|
||||||
"../core",
|
"../core",
|
||||||
"../var/document",
|
"../var/document",
|
||||||
"../var/isFunction",
|
|
||||||
"./var/rsingleTag",
|
"./var/rsingleTag",
|
||||||
|
|
||||||
"../traversing/findFilter"
|
"../traversing/findFilter"
|
||||||
], function( jQuery, document, isFunction, rsingleTag ) {
|
], function( jQuery, document, rsingleTag ) {
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
@ -64,7 +63,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 ( isFunction( this[ match ] ) ) {
|
if ( typeof this[ match ] === "function" ) {
|
||||||
this[ match ]( context[ match ] );
|
this[ match ]( context[ match ] );
|
||||||
|
|
||||||
// ...and otherwise set as attributes
|
// ...and otherwise set as attributes
|
||||||
@ -107,7 +106,7 @@ var rootjQuery,
|
|||||||
|
|
||||||
// HANDLE: $(function)
|
// HANDLE: $(function)
|
||||||
// Shortcut for document ready
|
// Shortcut for document ready
|
||||||
} else if ( isFunction( selector ) ) {
|
} else if ( typeof selector === "function" ) {
|
||||||
return root.ready !== undefined ?
|
return root.ready !== undefined ?
|
||||||
root.ready( selector ) :
|
root.ready( selector ) :
|
||||||
|
|
||||||
|
@ -10,8 +10,9 @@ define( [
|
|||||||
},
|
},
|
||||||
composed = { composed: true };
|
composed = { composed: true };
|
||||||
|
|
||||||
|
// Support: IE 9 - 11+, Edge 12 - 18+
|
||||||
// Check attachment across shadow DOM boundaries when possible (gh-3504)
|
// Check attachment across shadow DOM boundaries when possible (gh-3504)
|
||||||
if ( documentElement.attachShadow ) {
|
if ( documentElement.getRootNode ) {
|
||||||
isAttached = function( elem ) {
|
isAttached = function( elem ) {
|
||||||
return jQuery.contains( elem.ownerDocument, elem ) ||
|
return jQuery.contains( elem.ownerDocument, elem ) ||
|
||||||
elem.getRootNode( composed ) === elem.ownerDocument;
|
elem.getRootNode( composed ) === elem.ownerDocument;
|
||||||
|
@ -2,11 +2,8 @@ define( [
|
|||||||
"../core",
|
"../core",
|
||||||
"../var/document",
|
"../var/document",
|
||||||
"./var/rsingleTag",
|
"./var/rsingleTag",
|
||||||
"../manipulation/buildFragment",
|
"../manipulation/buildFragment"
|
||||||
|
], function( jQuery, document, rsingleTag, buildFragment ) {
|
||||||
// This is the only module that needs core/support
|
|
||||||
"./support"
|
|
||||||
], function( jQuery, document, rsingleTag, buildFragment, support ) {
|
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
@ -29,7 +26,6 @@ jQuery.parseHTML = function( data, context, keepScripts ) {
|
|||||||
|
|
||||||
// Stop scripts or inline event handlers from being executed immediately
|
// Stop scripts or inline event handlers from being executed immediately
|
||||||
// by using document.implementation
|
// by using document.implementation
|
||||||
if ( support.createHTMLDocument ) {
|
|
||||||
context = document.implementation.createHTMLDocument( "" );
|
context = document.implementation.createHTMLDocument( "" );
|
||||||
|
|
||||||
// Set the base href for the created document
|
// Set the base href for the created document
|
||||||
@ -38,9 +34,6 @@ jQuery.parseHTML = function( data, context, keepScripts ) {
|
|||||||
base = context.createElement( "base" );
|
base = context.createElement( "base" );
|
||||||
base.href = document.location.href;
|
base.href = document.location.href;
|
||||||
context.head.appendChild( base );
|
context.head.appendChild( base );
|
||||||
} else {
|
|
||||||
context = document;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
parsed = rsingleTag.exec( data );
|
parsed = rsingleTag.exec( data );
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
define( [
|
define( [
|
||||||
"../core",
|
"../core",
|
||||||
"../var/document",
|
"../var/document"
|
||||||
"../var/isFunction"
|
], function( jQuery, document ) {
|
||||||
], function( jQuery, document, isFunction ) {
|
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
@ -53,7 +52,7 @@ jQuery.extend( {
|
|||||||
|
|
||||||
while ( readyCallbacks.length ) {
|
while ( readyCallbacks.length ) {
|
||||||
fn = readyCallbacks.shift();
|
fn = readyCallbacks.shift();
|
||||||
if ( isFunction( fn ) ) {
|
if ( typeof fn === "function" ) {
|
||||||
executeReady( fn );
|
executeReady( fn );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -77,10 +76,7 @@ function completed() {
|
|||||||
|
|
||||||
// Catch cases where $(document).ready() is called
|
// Catch cases where $(document).ready() is called
|
||||||
// after the browser event has already occurred.
|
// after the browser event has already occurred.
|
||||||
// Support: IE9-10 only
|
if ( document.readyState !== "loading" ) {
|
||||||
// Older IE sometimes signals "interactive" too soon
|
|
||||||
if ( document.readyState === "complete" ||
|
|
||||||
( document.readyState !== "loading" && !document.documentElement.doScroll ) ) {
|
|
||||||
|
|
||||||
// Handle it asynchronously to allow scripts the opportunity to delay ready
|
// Handle it asynchronously to allow scripts the opportunity to delay ready
|
||||||
window.setTimeout( jQuery.ready );
|
window.setTimeout( jQuery.ready );
|
||||||
|
@ -66,10 +66,7 @@ function completed() {
|
|||||||
|
|
||||||
// Catch cases where $(document).ready() is called
|
// Catch cases where $(document).ready() is called
|
||||||
// after the browser event has already occurred.
|
// after the browser event has already occurred.
|
||||||
// Support: IE <=9 - 10 only
|
if ( document.readyState !== "loading" ) {
|
||||||
// Older IE sometimes signals "interactive" too soon
|
|
||||||
if ( document.readyState === "complete" ||
|
|
||||||
( document.readyState !== "loading" && !document.documentElement.doScroll ) ) {
|
|
||||||
|
|
||||||
// Handle it asynchronously to allow scripts the opportunity to delay ready
|
// Handle it asynchronously to allow scripts the opportunity to delay ready
|
||||||
window.setTimeout( jQuery.ready );
|
window.setTimeout( jQuery.ready );
|
||||||
|
@ -1,20 +0,0 @@
|
|||||||
define( [
|
|
||||||
"../var/document",
|
|
||||||
"../var/support"
|
|
||||||
], function( document, support ) {
|
|
||||||
|
|
||||||
"use strict";
|
|
||||||
|
|
||||||
// Support: Safari 8 only
|
|
||||||
// In Safari 8 documents created via document.implementation.createHTMLDocument
|
|
||||||
// collapse sibling forms: the second one becomes a child of the first one.
|
|
||||||
// Because of that, this security measure has to be disabled in Safari 8.
|
|
||||||
// https://bugs.webkit.org/show_bug.cgi?id=137337
|
|
||||||
support.createHTMLDocument = ( function() {
|
|
||||||
var body = document.implementation.createHTMLDocument( "" ).body;
|
|
||||||
body.innerHTML = "<form></form><form></form>";
|
|
||||||
return body.childNodes.length === 2;
|
|
||||||
} )();
|
|
||||||
|
|
||||||
return support;
|
|
||||||
} );
|
|
@ -10,8 +10,7 @@ function toType( obj ) {
|
|||||||
return obj + "";
|
return obj + "";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Support: Android <=2.3 only (functionish RegExp)
|
return typeof obj === "object" ?
|
||||||
return typeof obj === "object" || typeof obj === "function" ?
|
|
||||||
class2type[ toString.call( obj ) ] || "object" :
|
class2type[ toString.call( obj ) ] || "object" :
|
||||||
typeof obj;
|
typeof obj;
|
||||||
}
|
}
|
||||||
|
50
src/css.js
50
src/css.js
@ -10,7 +10,6 @@ define( [
|
|||||||
"./css/var/swap",
|
"./css/var/swap",
|
||||||
"./css/curCSS",
|
"./css/curCSS",
|
||||||
"./css/adjustCSS",
|
"./css/adjustCSS",
|
||||||
"./css/addGetHookIf",
|
|
||||||
"./css/support",
|
"./css/support",
|
||||||
"./css/finalPropName",
|
"./css/finalPropName",
|
||||||
|
|
||||||
@ -18,7 +17,7 @@ define( [
|
|||||||
"./core/ready",
|
"./core/ready",
|
||||||
"./selector" // contains
|
"./selector" // contains
|
||||||
], function( jQuery, access, rcssNum, rnumnonpx, cssExpand, isAutoPx, cssCamelCase,
|
], function( jQuery, access, rcssNum, rnumnonpx, cssExpand, isAutoPx, cssCamelCase,
|
||||||
getStyles, swap, curCSS, adjustCSS, addGetHookIf, support, finalPropName ) {
|
getStyles, swap, curCSS, adjustCSS, support, finalPropName ) {
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
@ -130,7 +129,6 @@ function getWidthOrHeight( elem, dimension, extra ) {
|
|||||||
val = curCSS( elem, dimension, styles ),
|
val = curCSS( elem, dimension, styles ),
|
||||||
offsetProp = "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 );
|
offsetProp = "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 );
|
||||||
|
|
||||||
// Support: Firefox <=54
|
|
||||||
// Return a confounding non-pixel value or feign ignorance, as appropriate.
|
// Return a confounding non-pixel value or feign ignorance, as appropriate.
|
||||||
if ( rnumnonpx.test( val ) ) {
|
if ( rnumnonpx.test( val ) ) {
|
||||||
if ( !extra ) {
|
if ( !extra ) {
|
||||||
@ -142,15 +140,11 @@ function getWidthOrHeight( elem, dimension, extra ) {
|
|||||||
|
|
||||||
// Fall back to offsetWidth/offsetHeight 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)
|
||||||
// Support: Android <=4.1 - 4.3 only
|
// Support: IE 9 - 11+
|
||||||
// Also use offsetWidth/offsetHeight for misreported inline dimensions (gh-3602)
|
|
||||||
// Support: IE 9-11 only
|
|
||||||
// Also use offsetWidth/offsetHeight for when box sizing is unreliable
|
// Also use offsetWidth/offsetHeight for when box sizing is unreliable
|
||||||
// We use getClientRects() to check for hidden/disconnected.
|
// We use getClientRects() to check for hidden/disconnected.
|
||||||
// In those cases, the computed value can be trusted to be border-box
|
// In those cases, the computed value can be trusted to be border-box
|
||||||
if ( ( !support.boxSizingReliable() && isBorderBox ||
|
if ( ( !support.boxSizingReliable() && isBorderBox || val === "auto" ) &&
|
||||||
val === "auto" ||
|
|
||||||
!parseFloat( val ) && jQuery.css( elem, "display", false, styles ) === "inline" ) &&
|
|
||||||
elem.getClientRects().length ) {
|
elem.getClientRects().length ) {
|
||||||
|
|
||||||
isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box";
|
isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box";
|
||||||
@ -324,10 +318,10 @@ jQuery.each( [ "height", "width" ], function( i, dimension ) {
|
|||||||
// but it must have a current display style that would benefit
|
// but it must have a current display style that would benefit
|
||||||
return rdisplayswap.test( jQuery.css( elem, "display" ) ) &&
|
return rdisplayswap.test( jQuery.css( elem, "display" ) ) &&
|
||||||
|
|
||||||
// Support: Safari 8+
|
// Support: Safari <=8 - 12+, Chrome <=73+
|
||||||
// Table columns in Safari have non-zero offsetWidth & zero
|
// Table columns in WebKit/Blink have non-zero offsetWidth & zero
|
||||||
// getBoundingClientRect().width unless display is changed.
|
// getBoundingClientRect().width unless display is changed.
|
||||||
// Support: IE <=11 only
|
// Support: IE <=11+
|
||||||
// Running getBoundingClientRect on a disconnected node
|
// Running getBoundingClientRect on a disconnected node
|
||||||
// in IE throws an error.
|
// in IE throws an error.
|
||||||
( !elem.getClientRects().length || !elem.getBoundingClientRect().width ) ?
|
( !elem.getClientRects().length || !elem.getBoundingClientRect().width ) ?
|
||||||
@ -342,14 +336,8 @@ jQuery.each( [ "height", "width" ], function( i, dimension ) {
|
|||||||
var matches,
|
var matches,
|
||||||
styles = getStyles( elem ),
|
styles = getStyles( elem ),
|
||||||
|
|
||||||
// Only read styles.position if the test has a chance to fail
|
|
||||||
// to avoid forcing a reflow.
|
|
||||||
scrollboxSizeBuggy = !support.scrollboxSize() &&
|
|
||||||
styles.position === "absolute",
|
|
||||||
|
|
||||||
// To avoid forcing a reflow, only fetch boxSizing if we need it (gh-3991)
|
// To avoid forcing a reflow, only fetch boxSizing if we need it (gh-3991)
|
||||||
boxSizingNeeded = scrollboxSizeBuggy || extra,
|
isBorderBox = extra &&
|
||||||
isBorderBox = boxSizingNeeded &&
|
|
||||||
jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
|
jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
|
||||||
subtract = extra ?
|
subtract = extra ?
|
||||||
boxModelAdjustment(
|
boxModelAdjustment(
|
||||||
@ -361,17 +349,6 @@ jQuery.each( [ "height", "width" ], function( i, dimension ) {
|
|||||||
) :
|
) :
|
||||||
0;
|
0;
|
||||||
|
|
||||||
// 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 && scrollboxSizeBuggy ) {
|
|
||||||
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" ) {
|
||||||
@ -385,19 +362,6 @@ jQuery.each( [ "height", "width" ], function( i, dimension ) {
|
|||||||
};
|
};
|
||||||
} );
|
} );
|
||||||
|
|
||||||
jQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft,
|
|
||||||
function( elem, computed ) {
|
|
||||||
if ( computed ) {
|
|
||||||
return ( parseFloat( curCSS( elem, "marginLeft" ) ) ||
|
|
||||||
elem.getBoundingClientRect().left -
|
|
||||||
swap( elem, { marginLeft: 0 }, function() {
|
|
||||||
return elem.getBoundingClientRect().left;
|
|
||||||
} )
|
|
||||||
) + "px";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
// These hooks are used by animate to expand properties
|
// These hooks are used by animate to expand properties
|
||||||
jQuery.each( {
|
jQuery.each( {
|
||||||
margin: "",
|
margin: "",
|
||||||
|
@ -1,26 +0,0 @@
|
|||||||
define( function() {
|
|
||||||
|
|
||||||
"use strict";
|
|
||||||
|
|
||||||
function addGetHookIf( conditionFn, hookFn ) {
|
|
||||||
|
|
||||||
// Define the hook, we'll check on the first run if it's really needed.
|
|
||||||
return {
|
|
||||||
get: function() {
|
|
||||||
if ( conditionFn() ) {
|
|
||||||
|
|
||||||
// Hook not needed (or it's not possible to use it due
|
|
||||||
// to missing dependency), remove it.
|
|
||||||
delete this.get;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Hook needed; redefine it so that the support test is not executed again.
|
|
||||||
return ( this.get = hookFn ).apply( this, arguments );
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
return addGetHookIf;
|
|
||||||
|
|
||||||
} );
|
|
@ -26,7 +26,7 @@ function adjustCSS( elem, prop, valueParts, tween ) {
|
|||||||
|
|
||||||
if ( initialInUnit && initialInUnit[ 3 ] !== unit ) {
|
if ( initialInUnit && initialInUnit[ 3 ] !== unit ) {
|
||||||
|
|
||||||
// Support: Firefox <=54
|
// Support: Firefox <=54 - 66+
|
||||||
// Halve the iteration target value to prevent interference from CSS upper bounds (gh-2144)
|
// Halve the iteration target value to prevent interference from CSS upper bounds (gh-2144)
|
||||||
initial = initial / 2;
|
initial = initial / 2;
|
||||||
|
|
||||||
|
@ -1,61 +1,28 @@
|
|||||||
define( [
|
define( [
|
||||||
"../core",
|
"../core",
|
||||||
"../core/isAttached",
|
"../core/isAttached",
|
||||||
"./var/rboxStyle",
|
"./var/getStyles"
|
||||||
"./var/rnumnonpx",
|
], function( jQuery, isAttached, rboxStyle, getStyles ) {
|
||||||
"./var/getStyles",
|
|
||||||
"./support"
|
|
||||||
], function( jQuery, isAttached, rboxStyle, rnumnonpx, getStyles, support ) {
|
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
function curCSS( elem, name, computed ) {
|
function curCSS( elem, name, computed ) {
|
||||||
var width, minWidth, maxWidth, ret,
|
var ret;
|
||||||
|
|
||||||
// Support: Firefox 51+
|
|
||||||
// Retrieving style before computed somehow
|
|
||||||
// fixes an issue with getting wrong values
|
|
||||||
// on detached elements
|
|
||||||
style = elem.style;
|
|
||||||
|
|
||||||
computed = computed || getStyles( elem );
|
computed = computed || getStyles( elem );
|
||||||
|
|
||||||
// getPropertyValue is needed for:
|
// getPropertyValue is needed for `.css('--customProperty')` (gh-3144)
|
||||||
// .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 ];
|
||||||
|
|
||||||
if ( ret === "" && !isAttached( elem ) ) {
|
if ( ret === "" && !isAttached( elem ) ) {
|
||||||
ret = jQuery.style( elem, name );
|
ret = jQuery.style( elem, name );
|
||||||
}
|
}
|
||||||
|
|
||||||
// A tribute to the "awesome hack by Dean Edwards"
|
|
||||||
// Android Browser returns percentage for some values,
|
|
||||||
// but width seems to be reliably pixels.
|
|
||||||
// This is against the CSSOM draft spec:
|
|
||||||
// https://drafts.csswg.org/cssom/#resolved-values
|
|
||||||
if ( !support.pixelBoxStyles() && rnumnonpx.test( ret ) && rboxStyle.test( name ) ) {
|
|
||||||
|
|
||||||
// Remember the original values
|
|
||||||
width = style.width;
|
|
||||||
minWidth = style.minWidth;
|
|
||||||
maxWidth = style.maxWidth;
|
|
||||||
|
|
||||||
// Put in the new values to get a computed value out
|
|
||||||
style.minWidth = style.maxWidth = style.width = ret;
|
|
||||||
ret = computed.width;
|
|
||||||
|
|
||||||
// Revert the changed values
|
|
||||||
style.width = width;
|
|
||||||
style.minWidth = minWidth;
|
|
||||||
style.maxWidth = maxWidth;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret !== undefined ?
|
return ret !== undefined ?
|
||||||
|
|
||||||
// Support: IE <=9 - 11 only
|
// Support: IE <=9 - 11+
|
||||||
// IE returns zIndex value as an integer.
|
// IE returns zIndex value as an integer.
|
||||||
ret + "" :
|
ret + "" :
|
||||||
ret;
|
ret;
|
||||||
|
@ -9,15 +9,26 @@ define( [
|
|||||||
|
|
||||||
( function() {
|
( function() {
|
||||||
|
|
||||||
// Executing both pixelPosition & boxSizingReliable tests require only one layout
|
var boxSizingReliableVal,
|
||||||
// so they're executed at the same time to save the second computation.
|
container = document.createElement( "div" ),
|
||||||
function computeStyleTests() {
|
div = document.createElement( "div" );
|
||||||
|
|
||||||
// This is a singleton, we need to execute it only once
|
// Finish early in limited (non-browser) environments
|
||||||
if ( !div ) {
|
if ( !div.style ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Support: IE <=9 - 11+
|
||||||
|
// Style of cloned element affects source element cloned (#8908)
|
||||||
|
div.style.backgroundClip = "content-box";
|
||||||
|
div.cloneNode( true ).style.backgroundClip = "";
|
||||||
|
support.clearCloneStyle = div.style.backgroundClip === "content-box";
|
||||||
|
|
||||||
|
jQuery.extend( support, {
|
||||||
|
boxSizingReliable: function() {
|
||||||
|
|
||||||
|
// This is a singleton, we need to execute it only once
|
||||||
|
if ( div ) {
|
||||||
container.style.cssText = "position:absolute;left:-11111px;width:60px;" +
|
container.style.cssText = "position:absolute;left:-11111px;width:60px;" +
|
||||||
"margin-top:1px;padding:0;border:0";
|
"margin-top:1px;padding:0;border:0";
|
||||||
div.style.cssText =
|
div.style.cssText =
|
||||||
@ -27,26 +38,10 @@ define( [
|
|||||||
documentElement.appendChild( container ).appendChild( div );
|
documentElement.appendChild( container ).appendChild( div );
|
||||||
|
|
||||||
var divStyle = window.getComputedStyle( div );
|
var divStyle = window.getComputedStyle( div );
|
||||||
pixelPositionVal = divStyle.top !== "1%";
|
|
||||||
|
|
||||||
// Support: Android 4.0 - 4.3 only, Firefox <=3 - 44
|
// Support: IE 9 - 11+
|
||||||
reliableMarginLeftVal = roundPixelMeasures( divStyle.marginLeft ) === 12;
|
|
||||||
|
|
||||||
// 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
|
|
||||||
div.style.right = "60%";
|
|
||||||
pixelBoxStylesVal = roundPixelMeasures( divStyle.right ) === 36;
|
|
||||||
|
|
||||||
// Support: IE 9 - 11 only
|
|
||||||
// Detect misreporting of content dimensions for box-sizing:border-box elements
|
// Detect misreporting of content dimensions for box-sizing:border-box elements
|
||||||
boxSizingReliableVal = roundPixelMeasures( divStyle.width ) === 36;
|
boxSizingReliableVal = Math.round( parseFloat( divStyle.width ) ) === 36;
|
||||||
|
|
||||||
// Support: IE 9 only
|
|
||||||
// Detect overflow:scroll screwiness (gh-3699)
|
|
||||||
// Support: Chrome <=64
|
|
||||||
// Don't get tricked when zoom affects offsetWidth (gh-4029)
|
|
||||||
div.style.position = "absolute";
|
|
||||||
scrollboxSizeVal = roundPixelMeasures( div.offsetWidth / 3 ) === 12;
|
|
||||||
|
|
||||||
documentElement.removeChild( container );
|
documentElement.removeChild( container );
|
||||||
|
|
||||||
@ -55,46 +50,7 @@ define( [
|
|||||||
div = null;
|
div = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
function roundPixelMeasures( measure ) {
|
|
||||||
return Math.round( parseFloat( measure ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
var pixelPositionVal, boxSizingReliableVal, scrollboxSizeVal, pixelBoxStylesVal,
|
|
||||||
reliableMarginLeftVal,
|
|
||||||
container = document.createElement( "div" ),
|
|
||||||
div = document.createElement( "div" );
|
|
||||||
|
|
||||||
// Finish early in limited (non-browser) environments
|
|
||||||
if ( !div.style ) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Support: IE <=9 - 11 only
|
|
||||||
// Style of cloned element affects source element cloned (#8908)
|
|
||||||
div.style.backgroundClip = "content-box";
|
|
||||||
div.cloneNode( true ).style.backgroundClip = "";
|
|
||||||
support.clearCloneStyle = div.style.backgroundClip === "content-box";
|
|
||||||
|
|
||||||
jQuery.extend( support, {
|
|
||||||
boxSizingReliable: function() {
|
|
||||||
computeStyleTests();
|
|
||||||
return boxSizingReliableVal;
|
return boxSizingReliableVal;
|
||||||
},
|
|
||||||
pixelBoxStyles: function() {
|
|
||||||
computeStyleTests();
|
|
||||||
return pixelBoxStylesVal;
|
|
||||||
},
|
|
||||||
pixelPosition: function() {
|
|
||||||
computeStyleTests();
|
|
||||||
return pixelPositionVal;
|
|
||||||
},
|
|
||||||
reliableMarginLeft: function() {
|
|
||||||
computeStyleTests();
|
|
||||||
return reliableMarginLeftVal;
|
|
||||||
},
|
|
||||||
scrollboxSize: function() {
|
|
||||||
computeStyleTests();
|
|
||||||
return scrollboxSizeVal;
|
|
||||||
}
|
}
|
||||||
} );
|
} );
|
||||||
} )();
|
} )();
|
||||||
|
@ -3,12 +3,14 @@ define( function() {
|
|||||||
|
|
||||||
return function( elem ) {
|
return function( elem ) {
|
||||||
|
|
||||||
// Support: IE <=11 only, Firefox <=30 (#15098, #14150)
|
// Support: IE <=11+ (trac-14150)
|
||||||
// IE throws on elements created in popups
|
// In IE popup's `window` is the opener window which makes `window.getComputedStyle( elem )`
|
||||||
// FF meanwhile throws on frame elements through "defaultView.getComputedStyle"
|
// break. Using `elem.ownerDocument.defaultView` avoids the issue.
|
||||||
var view = elem.ownerDocument.defaultView;
|
var view = elem.ownerDocument.defaultView;
|
||||||
|
|
||||||
if ( !view || !view.opener ) {
|
// `document.implementation.createHTMLDocument( "" )` has a `null` `defaultView`
|
||||||
|
// property; check `defaultView` truthiness to fallback to window in such a case.
|
||||||
|
if ( !view ) {
|
||||||
view = window;
|
view = window;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,9 +1,8 @@
|
|||||||
define( [
|
define( [
|
||||||
"../../core",
|
"../../core"
|
||||||
"../../core/isAttached"
|
|
||||||
|
|
||||||
// css is assumed
|
// css is assumed
|
||||||
], function( jQuery, isAttached ) {
|
], function( jQuery ) {
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
// isHiddenWithinTree reports if an element has a non-"none" display style (inline and/or
|
// isHiddenWithinTree reports if an element has a non-"none" display style (inline and/or
|
||||||
@ -22,13 +21,6 @@ define( [
|
|||||||
// Inline style trumps all
|
// Inline style trumps all
|
||||||
return elem.style.display === "none" ||
|
return elem.style.display === "none" ||
|
||||||
elem.style.display === "" &&
|
elem.style.display === "" &&
|
||||||
|
|
||||||
// Otherwise, check computed style
|
|
||||||
// Support: Firefox <=43 - 45
|
|
||||||
// Disconnected elements can have computed display: none, so first confirm that elem is
|
|
||||||
// in the document.
|
|
||||||
isAttached( elem ) &&
|
|
||||||
|
|
||||||
jQuery.css( elem, "display" ) === "none";
|
jQuery.css( elem, "display" ) === "none";
|
||||||
};
|
};
|
||||||
} );
|
} );
|
||||||
|
@ -108,7 +108,7 @@ jQuery.fn.extend( {
|
|||||||
i = attrs.length;
|
i = attrs.length;
|
||||||
while ( i-- ) {
|
while ( i-- ) {
|
||||||
|
|
||||||
// Support: IE 11 only
|
// Support: IE 11+
|
||||||
// The attrs elements can be null (#14894)
|
// The attrs elements can be null (#14894)
|
||||||
if ( attrs[ i ] ) {
|
if ( attrs[ i ] ) {
|
||||||
name = attrs[ i ].name;
|
name = attrs[ i ].name;
|
||||||
|
@ -141,7 +141,7 @@ Data.prototype = {
|
|||||||
// Remove the expando if there's no more data
|
// Remove the expando if there's no more data
|
||||||
if ( key === undefined || jQuery.isEmptyObject( cache ) ) {
|
if ( key === undefined || jQuery.isEmptyObject( cache ) ) {
|
||||||
|
|
||||||
// Support: Chrome <=35 - 45
|
// Support: Chrome <=35 - 45+
|
||||||
// Webkit & Blink performance suffers when deleting properties
|
// Webkit & Blink performance suffers when deleting properties
|
||||||
// from DOM nodes, so set to undefined instead
|
// from DOM nodes, so set to undefined instead
|
||||||
// https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted)
|
// https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted)
|
||||||
|
@ -1,9 +1,8 @@
|
|||||||
define( [
|
define( [
|
||||||
"./core",
|
"./core",
|
||||||
"./var/isFunction",
|
|
||||||
"./var/slice",
|
"./var/slice",
|
||||||
"./callbacks"
|
"./callbacks"
|
||||||
], function( jQuery, isFunction, slice ) {
|
], function( jQuery, slice ) {
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
@ -20,11 +19,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 && isFunction( ( method = value.promise ) ) ) {
|
if ( value && typeof( method = value.promise ) === "function" ) {
|
||||||
method.call( value ).done( resolve ).fail( reject );
|
method.call( value ).done( resolve ).fail( reject );
|
||||||
|
|
||||||
// Other thenables
|
// Other thenables
|
||||||
} else if ( value && isFunction( ( method = value.then ) ) ) {
|
} else if ( value && typeof( method = value.then ) === "function" ) {
|
||||||
method.call( value, resolve, reject );
|
method.call( value, resolve, reject );
|
||||||
|
|
||||||
// Other non-thenables
|
// Other non-thenables
|
||||||
@ -40,10 +39,7 @@ function adoptValue( value, resolve, reject, noValue ) {
|
|||||||
// Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in
|
// Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in
|
||||||
// Deferred#then to conditionally suppress rejection.
|
// Deferred#then to conditionally suppress rejection.
|
||||||
} catch ( value ) {
|
} catch ( value ) {
|
||||||
|
reject( value );
|
||||||
// Support: Android 4.0 only
|
|
||||||
// Strict mode functions invoked without .call/.apply get global-object context
|
|
||||||
reject.apply( undefined, [ value ] );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -70,7 +66,7 @@ jQuery.extend( {
|
|||||||
deferred.done( arguments ).fail( arguments );
|
deferred.done( arguments ).fail( arguments );
|
||||||
return this;
|
return this;
|
||||||
},
|
},
|
||||||
"catch": function( fn ) {
|
catch: function( fn ) {
|
||||||
return promise.then( null, fn );
|
return promise.then( null, fn );
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -82,14 +78,15 @@ 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 = isFunction( fns[ tuple[ 4 ] ] ) && fns[ tuple[ 4 ] ];
|
var fn = typeof fns[ tuple[ 4 ] ] === "function" &&
|
||||||
|
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 && isFunction( returned.promise ) ) {
|
if ( returned && typeof returned.promise === "function" ) {
|
||||||
returned.promise()
|
returned.promise()
|
||||||
.progress( newDefer.notify )
|
.progress( newDefer.notify )
|
||||||
.done( newDefer.resolve )
|
.done( newDefer.resolve )
|
||||||
@ -143,7 +140,7 @@ jQuery.extend( {
|
|||||||
returned.then;
|
returned.then;
|
||||||
|
|
||||||
// Handle a returned thenable
|
// Handle a returned thenable
|
||||||
if ( isFunction( then ) ) {
|
if ( typeof then === "function" ) {
|
||||||
|
|
||||||
// Special processors (notify) just wait for resolution
|
// Special processors (notify) just wait for resolution
|
||||||
if ( special ) {
|
if ( special ) {
|
||||||
@ -239,7 +236,7 @@ jQuery.extend( {
|
|||||||
resolve(
|
resolve(
|
||||||
0,
|
0,
|
||||||
newDefer,
|
newDefer,
|
||||||
isFunction( onProgress ) ?
|
typeof onProgress === "function" ?
|
||||||
onProgress :
|
onProgress :
|
||||||
Identity,
|
Identity,
|
||||||
newDefer.notifyWith
|
newDefer.notifyWith
|
||||||
@ -251,7 +248,7 @@ jQuery.extend( {
|
|||||||
resolve(
|
resolve(
|
||||||
0,
|
0,
|
||||||
newDefer,
|
newDefer,
|
||||||
isFunction( onFulfilled ) ?
|
typeof onFulfilled === "function" ?
|
||||||
onFulfilled :
|
onFulfilled :
|
||||||
Identity
|
Identity
|
||||||
)
|
)
|
||||||
@ -262,7 +259,7 @@ jQuery.extend( {
|
|||||||
resolve(
|
resolve(
|
||||||
0,
|
0,
|
||||||
newDefer,
|
newDefer,
|
||||||
isFunction( onRejected ) ?
|
typeof onRejected === "function" ?
|
||||||
onRejected :
|
onRejected :
|
||||||
Thrower
|
Thrower
|
||||||
)
|
)
|
||||||
@ -380,7 +377,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" ||
|
||||||
isFunction( resolveValues[ i ] && resolveValues[ i ].then ) ) {
|
typeof( resolveValues[ i ] && resolveValues[ i ].then ) === "function" ) {
|
||||||
|
|
||||||
return master.then();
|
return master.then();
|
||||||
}
|
}
|
||||||
|
@ -11,10 +11,12 @@ var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;
|
|||||||
|
|
||||||
jQuery.Deferred.exceptionHook = function( error, stack ) {
|
jQuery.Deferred.exceptionHook = function( error, stack ) {
|
||||||
|
|
||||||
// Support: IE 8 - 9 only
|
if ( error && rerrorNames.test( error.name ) ) {
|
||||||
// Console exists when dev tools are open, which can happen at any time
|
window.console.warn(
|
||||||
if ( window.console && window.console.warn && error && rerrorNames.test( error.name ) ) {
|
"jQuery.Deferred exception: " + error.message,
|
||||||
window.console.warn( "jQuery.Deferred exception: " + error.message, error.stack, stack );
|
error.stack,
|
||||||
|
stack
|
||||||
|
);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -3,12 +3,11 @@ define( [
|
|||||||
"./core/nodeName",
|
"./core/nodeName",
|
||||||
"./core/toType",
|
"./core/toType",
|
||||||
"./css/cssCamelCase",
|
"./css/cssCamelCase",
|
||||||
"./var/isFunction",
|
|
||||||
"./var/isWindow",
|
"./var/isWindow",
|
||||||
"./var/slice",
|
"./var/slice",
|
||||||
|
|
||||||
"./event/alias"
|
"./event/alias"
|
||||||
], function( jQuery, nodeName, toType, cssCamelCase, isFunction, isWindow, slice ) {
|
], function( jQuery, nodeName, toType, cssCamelCase, isWindow, slice ) {
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
@ -48,7 +47,7 @@ jQuery.proxy = function( fn, context ) {
|
|||||||
|
|
||||||
// Quick check to determine if target is callable, in the spec
|
// Quick check to determine if target is callable, in the spec
|
||||||
// this throws a TypeError, but we will just return undefined.
|
// this throws a TypeError, but we will just return undefined.
|
||||||
if ( !isFunction( fn ) ) {
|
if ( typeof fn !== "function" ) {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
22
src/effects.js
vendored
22
src/effects.js
vendored
@ -1,7 +1,6 @@
|
|||||||
define( [
|
define( [
|
||||||
"./core",
|
"./core",
|
||||||
"./var/document",
|
"./var/document",
|
||||||
"./var/isFunction",
|
|
||||||
"./var/rcssNum",
|
"./var/rcssNum",
|
||||||
"./var/rnothtmlwhite",
|
"./var/rnothtmlwhite",
|
||||||
"./css/var/cssExpand",
|
"./css/var/cssExpand",
|
||||||
@ -19,7 +18,7 @@ define( [
|
|||||||
"./manipulation",
|
"./manipulation",
|
||||||
"./css",
|
"./css",
|
||||||
"./effects/Tween"
|
"./effects/Tween"
|
||||||
], function( jQuery, document, isFunction, rcssNum, rnothtmlwhite, cssExpand,
|
], function( jQuery, document, rcssNum, rnothtmlwhite, cssExpand,
|
||||||
isHiddenWithinTree, swap, adjustCSS, cssCamelCase, dataPriv, showHide ) {
|
isHiddenWithinTree, swap, adjustCSS, cssCamelCase, dataPriv, showHide ) {
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
@ -150,7 +149,7 @@ 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 - 15
|
// Support: IE <=9 - 11+, Edge 12 - 18+
|
||||||
// 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 and Edge just mirrors
|
// from identically-valued overflowX and overflowY and Edge just mirrors
|
||||||
// the overflowX value there.
|
// the overflowX value there.
|
||||||
@ -310,10 +309,7 @@ function Animation( elem, properties, options ) {
|
|||||||
var currentTime = fxNow || createFxNow(),
|
var currentTime = fxNow || createFxNow(),
|
||||||
remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),
|
remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),
|
||||||
|
|
||||||
// Support: Android 2.3 only
|
percent = 1 - ( remaining / animation.duration || 0 ),
|
||||||
// Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497)
|
|
||||||
temp = remaining / animation.duration || 0,
|
|
||||||
percent = 1 - temp,
|
|
||||||
index = 0,
|
index = 0,
|
||||||
length = animation.tweens.length;
|
length = animation.tweens.length;
|
||||||
|
|
||||||
@ -386,7 +382,7 @@ 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 ( isFunction( result.stop ) ) {
|
if ( typeof result.stop === "function" ) {
|
||||||
jQuery._queueHooks( animation.elem, animation.opts.queue ).stop =
|
jQuery._queueHooks( animation.elem, animation.opts.queue ).stop =
|
||||||
result.stop.bind( result );
|
result.stop.bind( result );
|
||||||
}
|
}
|
||||||
@ -396,7 +392,7 @@ function Animation( elem, properties, options ) {
|
|||||||
|
|
||||||
jQuery.map( props, createTween, animation );
|
jQuery.map( props, createTween, animation );
|
||||||
|
|
||||||
if ( isFunction( animation.opts.start ) ) {
|
if ( typeof animation.opts.start === "function" ) {
|
||||||
animation.opts.start.call( elem, animation );
|
animation.opts.start.call( elem, animation );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -429,7 +425,7 @@ jQuery.Animation = jQuery.extend( Animation, {
|
|||||||
},
|
},
|
||||||
|
|
||||||
tweener: function( props, callback ) {
|
tweener: function( props, callback ) {
|
||||||
if ( isFunction( props ) ) {
|
if ( typeof props === "function" ) {
|
||||||
callback = props;
|
callback = props;
|
||||||
props = [ "*" ];
|
props = [ "*" ];
|
||||||
} else {
|
} else {
|
||||||
@ -461,9 +457,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 ||
|
||||||
isFunction( speed ) && speed,
|
typeof speed === "function" && speed,
|
||||||
duration: speed,
|
duration: speed,
|
||||||
easing: fn && easing || easing && !isFunction( easing ) && easing
|
easing: fn && easing || easing && typeof easing !== "function" && easing
|
||||||
};
|
};
|
||||||
|
|
||||||
// Go to the end state if fx are off
|
// Go to the end state if fx are off
|
||||||
@ -490,7 +486,7 @@ jQuery.speed = function( speed, easing, fn ) {
|
|||||||
opt.old = opt.complete;
|
opt.old = opt.complete;
|
||||||
|
|
||||||
opt.complete = function() {
|
opt.complete = function() {
|
||||||
if ( isFunction( opt.old ) ) {
|
if ( typeof opt.old === "function" ) {
|
||||||
opt.old.call( this );
|
opt.old.call( this );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -98,16 +98,6 @@ Tween.propHooks = {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// Support: IE <=9 only
|
|
||||||
// Panic based approach to setting things on disconnected nodes
|
|
||||||
Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
|
|
||||||
set: function( tween ) {
|
|
||||||
if ( tween.elem.nodeType && tween.elem.parentNode ) {
|
|
||||||
tween.elem[ tween.prop ] = tween.now;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
jQuery.easing = {
|
jQuery.easing = {
|
||||||
linear: function( p ) {
|
linear: function( p ) {
|
||||||
return p;
|
return p;
|
||||||
|
47
src/event.js
47
src/event.js
@ -2,7 +2,6 @@ define( [
|
|||||||
"./core",
|
"./core",
|
||||||
"./var/document",
|
"./var/document",
|
||||||
"./var/documentElement",
|
"./var/documentElement",
|
||||||
"./var/isFunction",
|
|
||||||
"./var/rnothtmlwhite",
|
"./var/rnothtmlwhite",
|
||||||
"./var/rcheckableType",
|
"./var/rcheckableType",
|
||||||
"./var/slice",
|
"./var/slice",
|
||||||
@ -11,7 +10,7 @@ define( [
|
|||||||
|
|
||||||
"./core/init",
|
"./core/init",
|
||||||
"./selector"
|
"./selector"
|
||||||
], function( jQuery, document, documentElement, isFunction, rnothtmlwhite,
|
], function( jQuery, document, documentElement, rnothtmlwhite,
|
||||||
rcheckableType, slice, dataPriv, nodeName ) {
|
rcheckableType, slice, dataPriv, nodeName ) {
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
@ -36,16 +35,7 @@ function returnFalse() {
|
|||||||
// (focus and blur are always synchronous in other supported browsers,
|
// (focus and blur are always synchronous in other supported browsers,
|
||||||
// this just defines when we can count on it).
|
// this just defines when we can count on it).
|
||||||
function expectSync( elem, type ) {
|
function expectSync( elem, type ) {
|
||||||
return ( elem === safeActiveElement() ) === ( type === "focus" );
|
return ( elem === document.activeElement ) === ( type === "focus" );
|
||||||
}
|
|
||||||
|
|
||||||
// Support: IE <=9 only
|
|
||||||
// Accessing document.activeElement can throw unexpectedly
|
|
||||||
// https://bugs.jquery.com/ticket/13393
|
|
||||||
function safeActiveElement() {
|
|
||||||
try {
|
|
||||||
return document.activeElement;
|
|
||||||
} catch ( err ) { }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function on( elem, types, selector, data, fn, one ) {
|
function on( elem, types, selector, data, fn, one ) {
|
||||||
@ -379,14 +369,10 @@ jQuery.event = {
|
|||||||
// Find delegate handlers
|
// Find delegate handlers
|
||||||
if ( delegateCount &&
|
if ( delegateCount &&
|
||||||
|
|
||||||
// Support: IE <=9
|
// Support: Firefox <=42 - 66+
|
||||||
// Black-hole SVG <use> instance trees (trac-13180)
|
|
||||||
cur.nodeType &&
|
|
||||||
|
|
||||||
// Support: Firefox <=42
|
|
||||||
// Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861)
|
// Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861)
|
||||||
// https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click
|
// https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click
|
||||||
// Support: IE 11 only
|
// Support: IE 11+
|
||||||
// ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343)
|
// ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343)
|
||||||
!( event.type === "click" && event.button >= 1 ) ) {
|
!( event.type === "click" && event.button >= 1 ) ) {
|
||||||
|
|
||||||
@ -433,7 +419,7 @@ jQuery.event = {
|
|||||||
enumerable: true,
|
enumerable: true,
|
||||||
configurable: true,
|
configurable: true,
|
||||||
|
|
||||||
get: isFunction( hook ) ?
|
get: typeof hook === "function" ?
|
||||||
function() {
|
function() {
|
||||||
if ( this.originalEvent ) {
|
if ( this.originalEvent ) {
|
||||||
return hook( this.originalEvent );
|
return hook( this.originalEvent );
|
||||||
@ -519,8 +505,9 @@ jQuery.event = {
|
|||||||
beforeunload: {
|
beforeunload: {
|
||||||
postDispatch: function( event ) {
|
postDispatch: function( event ) {
|
||||||
|
|
||||||
// Support: Firefox 20+
|
// Support: Chrome <=73+
|
||||||
// Firefox doesn't alert if the returnValue field is not set.
|
// Chrome doesn't alert on `event.preventDefault()`
|
||||||
|
// as the standard mandates.
|
||||||
if ( event.result !== undefined && event.originalEvent ) {
|
if ( event.result !== undefined && event.originalEvent ) {
|
||||||
event.originalEvent.returnValue = event.result;
|
event.originalEvent.returnValue = event.result;
|
||||||
}
|
}
|
||||||
@ -638,21 +625,12 @@ jQuery.Event = function( src, props ) {
|
|||||||
|
|
||||||
// Events bubbling up the document may have been marked as prevented
|
// Events bubbling up the document may have been marked as prevented
|
||||||
// by a handler lower down the tree; reflect the correct value.
|
// by a handler lower down the tree; reflect the correct value.
|
||||||
this.isDefaultPrevented = src.defaultPrevented ||
|
this.isDefaultPrevented = src.defaultPrevented ?
|
||||||
src.defaultPrevented === undefined &&
|
|
||||||
|
|
||||||
// Support: Android <=2.3 only
|
|
||||||
src.returnValue === false ?
|
|
||||||
returnTrue :
|
returnTrue :
|
||||||
returnFalse;
|
returnFalse;
|
||||||
|
|
||||||
// Create target properties
|
// Create target properties
|
||||||
// Support: Safari <=6 - 7 only
|
this.target = src.target;
|
||||||
// Target should not be a text node (#504, #13143)
|
|
||||||
this.target = ( src.target && src.target.nodeType === 3 ) ?
|
|
||||||
src.target.parentNode :
|
|
||||||
src.target;
|
|
||||||
|
|
||||||
this.currentTarget = src.currentTarget;
|
this.currentTarget = src.currentTarget;
|
||||||
this.relatedTarget = src.relatedTarget;
|
this.relatedTarget = src.relatedTarget;
|
||||||
|
|
||||||
@ -805,11 +783,6 @@ jQuery.each( { focus: "focusin", blur: "focusout" }, function( type, delegateTyp
|
|||||||
// Create mouseenter/leave events using mouseover/out and event-time checks
|
// Create mouseenter/leave events using mouseover/out and event-time checks
|
||||||
// so that event delegation works in jQuery.
|
// so that event delegation works in jQuery.
|
||||||
// Do the same for pointerenter/pointerleave and pointerover/pointerout
|
// Do the same for pointerenter/pointerleave and pointerover/pointerout
|
||||||
//
|
|
||||||
// Support: Safari 7 only
|
|
||||||
// Safari sends mouseenter too often; see:
|
|
||||||
// https://bugs.chromium.org/p/chromium/issues/detail?id=470258
|
|
||||||
// for the description of the bug (it existed in older Chrome versions as well).
|
|
||||||
jQuery.each( {
|
jQuery.each( {
|
||||||
mouseenter: "mouseover",
|
mouseenter: "mouseover",
|
||||||
mouseleave: "mouseout",
|
mouseleave: "mouseout",
|
||||||
|
@ -4,10 +4,9 @@ define( [
|
|||||||
"../data/var/dataPriv",
|
"../data/var/dataPriv",
|
||||||
"../data/var/acceptData",
|
"../data/var/acceptData",
|
||||||
"../var/hasOwn",
|
"../var/hasOwn",
|
||||||
"../var/isFunction",
|
|
||||||
"../var/isWindow",
|
"../var/isWindow",
|
||||||
"../event"
|
"../event"
|
||||||
], function( jQuery, document, dataPriv, acceptData, hasOwn, isFunction, isWindow ) {
|
], function( jQuery, document, dataPriv, acceptData, hasOwn, isWindow ) {
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
@ -129,7 +128,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 && isFunction( elem[ type ] ) && !isWindow( elem ) ) {
|
if ( ontype && typeof elem[ type ] === "function" && !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 ];
|
||||||
|
@ -2,7 +2,6 @@ define( [
|
|||||||
"./core",
|
"./core",
|
||||||
"./core/isAttached",
|
"./core/isAttached",
|
||||||
"./var/concat",
|
"./var/concat",
|
||||||
"./var/isFunction",
|
|
||||||
"./var/push",
|
"./var/push",
|
||||||
"./var/rcheckableType",
|
"./var/rcheckableType",
|
||||||
"./core/access",
|
"./core/access",
|
||||||
@ -24,7 +23,7 @@ define( [
|
|||||||
"./traversing",
|
"./traversing",
|
||||||
"./selector",
|
"./selector",
|
||||||
"./event"
|
"./event"
|
||||||
], function( jQuery, isAttached, concat, isFunction, push, rcheckableType,
|
], function( jQuery, isAttached, concat, push, rcheckableType,
|
||||||
access, rtagName, rscriptType,
|
access, rtagName, rscriptType,
|
||||||
wrapMap, getAll, setGlobalEval, buildFragment, support,
|
wrapMap, getAll, setGlobalEval, buildFragment, support,
|
||||||
dataPriv, dataUser, acceptData, DOMEval, nodeName ) {
|
dataPriv, dataUser, acceptData, DOMEval, nodeName ) {
|
||||||
@ -40,13 +39,11 @@ var
|
|||||||
|
|
||||||
/* eslint-enable */
|
/* eslint-enable */
|
||||||
|
|
||||||
// Support: IE <=10 - 11, Edge 12 - 13 only
|
// 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
|
|
||||||
rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
|
|
||||||
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
|
||||||
@ -109,20 +106,6 @@ function cloneCopyEvent( src, dest ) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fix IE bugs, see support tests
|
|
||||||
function fixInput( src, dest ) {
|
|
||||||
var nodeName = dest.nodeName.toLowerCase();
|
|
||||||
|
|
||||||
// Fails to persist the checked state of a cloned checkbox or radio button.
|
|
||||||
if ( nodeName === "input" && rcheckableType.test( src.type ) ) {
|
|
||||||
dest.checked = src.checked;
|
|
||||||
|
|
||||||
// Fails to return the selected option to the default selected state when cloning options
|
|
||||||
} else if ( nodeName === "input" || nodeName === "textarea" ) {
|
|
||||||
dest.defaultValue = src.defaultValue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function domManip( collection, args, callback, ignored ) {
|
function domManip( collection, args, callback, ignored ) {
|
||||||
|
|
||||||
// Flatten any nested arrays
|
// Flatten any nested arrays
|
||||||
@ -133,17 +116,12 @@ function domManip( collection, args, callback, ignored ) {
|
|||||||
l = collection.length,
|
l = collection.length,
|
||||||
iNoClone = l - 1,
|
iNoClone = l - 1,
|
||||||
value = args[ 0 ],
|
value = args[ 0 ],
|
||||||
valueIsFunction = isFunction( value );
|
valueIsFunction = typeof value === "function";
|
||||||
|
|
||||||
// We can't cloneNode fragments that contain checked, in WebKit
|
if ( valueIsFunction ) {
|
||||||
if ( valueIsFunction ||
|
|
||||||
( l > 1 && typeof value === "string" &&
|
|
||||||
!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 ( 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 );
|
||||||
} );
|
} );
|
||||||
}
|
}
|
||||||
@ -172,9 +150,6 @@ function domManip( collection, args, callback, ignored ) {
|
|||||||
|
|
||||||
// Keep references to cloned scripts for later restoration
|
// Keep references to cloned scripts for later restoration
|
||||||
if ( hasScripts ) {
|
if ( hasScripts ) {
|
||||||
|
|
||||||
// Support: Android <=4.0 only, PhantomJS 1 only
|
|
||||||
// push.apply(_, arraylike) throws on ancient WebKit
|
|
||||||
jQuery.merge( scripts, getAll( node, "script" ) );
|
jQuery.merge( scripts, getAll( node, "script" ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -255,7 +230,13 @@ jQuery.extend( {
|
|||||||
srcElements = getAll( elem );
|
srcElements = getAll( elem );
|
||||||
|
|
||||||
for ( i = 0, l = srcElements.length; i < l; i++ ) {
|
for ( i = 0, l = srcElements.length; i < l; i++ ) {
|
||||||
fixInput( srcElements[ i ], destElements[ i ] );
|
|
||||||
|
// Support: IE <=11+
|
||||||
|
// IE fails to set the defaultValue to the correct value when
|
||||||
|
// cloning other types of input fields
|
||||||
|
if ( destElements[ i ].nodeName.toLowerCase() === "textarea" ) {
|
||||||
|
destElements[ i ].defaultValue = srcElements[ i ].defaultValue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -475,9 +456,6 @@ jQuery.each( {
|
|||||||
for ( ; i <= last; i++ ) {
|
for ( ; i <= last; i++ ) {
|
||||||
elems = i === last ? this : this.clone( true );
|
elems = i === last ? this : this.clone( true );
|
||||||
jQuery( insert[ i ] )[ original ]( elems );
|
jQuery( insert[ i ] )[ original ]( elems );
|
||||||
|
|
||||||
// Support: Android <=4.0 only, PhantomJS 1 only
|
|
||||||
// .get() because push.apply(_, arraylike) throws on ancient WebKit
|
|
||||||
push.apply( ret, elems.get() );
|
push.apply( ret, elems.get() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,9 +27,6 @@ function buildFragment( elems, context, scripts, selection, ignored ) {
|
|||||||
|
|
||||||
// Add nodes directly
|
// Add nodes directly
|
||||||
if ( toType( elem ) === "object" ) {
|
if ( toType( elem ) === "object" ) {
|
||||||
|
|
||||||
// Support: Android <=4.0 only, PhantomJS 1 only
|
|
||||||
// push.apply(_, arraylike) throws on ancient WebKit
|
|
||||||
jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem );
|
jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem );
|
||||||
|
|
||||||
// Convert non-html into a text node
|
// Convert non-html into a text node
|
||||||
@ -51,8 +48,6 @@ function buildFragment( elems, context, scripts, selection, ignored ) {
|
|||||||
tmp = tmp.lastChild;
|
tmp = tmp.lastChild;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Support: Android <=4.0 only, PhantomJS 1 only
|
|
||||||
// push.apply(_, arraylike) throws on ancient WebKit
|
|
||||||
jQuery.merge( nodes, tmp.childNodes );
|
jQuery.merge( nodes, tmp.childNodes );
|
||||||
|
|
||||||
// Remember the top-level container
|
// Remember the top-level container
|
||||||
|
@ -7,7 +7,7 @@ define( [
|
|||||||
|
|
||||||
function getAll( context, tag ) {
|
function getAll( context, tag ) {
|
||||||
|
|
||||||
// Support: IE <=9 - 11 only
|
// Support: IE <=9 - 11+
|
||||||
// Use typeof to avoid zero-argument method invocation on host objects (#15151)
|
// Use typeof to avoid zero-argument method invocation on host objects (#15151)
|
||||||
var ret;
|
var ret;
|
||||||
|
|
||||||
|
@ -10,21 +10,14 @@ define( [
|
|||||||
div = fragment.appendChild( document.createElement( "div" ) ),
|
div = fragment.appendChild( document.createElement( "div" ) ),
|
||||||
input = document.createElement( "input" );
|
input = document.createElement( "input" );
|
||||||
|
|
||||||
// Support: Android 4.0 - 4.3 only
|
|
||||||
// Check state lost if the name is set (#11217)
|
|
||||||
// Support: Windows Web Apps (WWA)
|
// Support: Windows Web Apps (WWA)
|
||||||
// `name` and `type` must use .setAttribute for WWA (#14901)
|
// `name` and `type` must use .setAttribute for WWA (#14901)
|
||||||
input.setAttribute( "type", "radio" );
|
input.setAttribute( "type", "radio" );
|
||||||
input.setAttribute( "checked", "checked" );
|
input.setAttribute( "checked", "checked" );
|
||||||
input.setAttribute( "name", "t" );
|
|
||||||
|
|
||||||
div.appendChild( input );
|
div.appendChild( input );
|
||||||
|
|
||||||
// Support: Android <=4.1 only
|
// Support: IE <=11+
|
||||||
// Older WebKit doesn't clone checked state correctly in fragments
|
|
||||||
support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked;
|
|
||||||
|
|
||||||
// Support: IE <=11 only
|
|
||||||
// Make sure textarea (and checkbox) defaultValue is properly cloned
|
// Make sure textarea (and checkbox) defaultValue is properly cloned
|
||||||
div.innerHTML = "<textarea>x</textarea>";
|
div.innerHTML = "<textarea>x</textarea>";
|
||||||
support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue;
|
support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue;
|
||||||
|
@ -5,11 +5,10 @@ define( function() {
|
|||||||
// We have to close these tags to support XHTML (#13200)
|
// We have to close these tags to support XHTML (#13200)
|
||||||
var wrapMap = {
|
var wrapMap = {
|
||||||
|
|
||||||
// Support: IE <=9 only
|
// Table parts need to be wrapped with `<table>` or they're
|
||||||
option: [ 1, "<select multiple='multiple'>", "</select>" ],
|
// stripped to their contents when put in a div.
|
||||||
|
|
||||||
// XHTML parsers do not magically insert elements in the
|
// XHTML parsers do not magically insert elements in the
|
||||||
// same way that tag soup parsers do. So we cannot shorten
|
// same way that tag soup parsers do, so we cannot shorten
|
||||||
// this by omitting <tbody> or other required elements.
|
// this by omitting <tbody> or other required elements.
|
||||||
thead: [ 1, "<table>", "</table>" ],
|
thead: [ 1, "<table>", "</table>" ],
|
||||||
col: [ 2, "<table><colgroup>", "</colgroup></table>" ],
|
col: [ 2, "<table><colgroup>", "</colgroup></table>" ],
|
||||||
@ -19,9 +18,6 @@ var wrapMap = {
|
|||||||
_default: [ 0, "", "" ]
|
_default: [ 0, "", "" ]
|
||||||
};
|
};
|
||||||
|
|
||||||
// Support: IE <=9 only
|
|
||||||
wrapMap.optgroup = wrapMap.option;
|
|
||||||
|
|
||||||
wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
|
wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
|
||||||
wrapMap.th = wrapMap.td;
|
wrapMap.th = wrapMap.td;
|
||||||
|
|
||||||
|
@ -3,17 +3,13 @@ define( [
|
|||||||
"./core/access",
|
"./core/access",
|
||||||
"./var/document",
|
"./var/document",
|
||||||
"./var/documentElement",
|
"./var/documentElement",
|
||||||
"./var/isFunction",
|
|
||||||
"./css/var/rnumnonpx",
|
"./css/var/rnumnonpx",
|
||||||
"./css/curCSS",
|
"./css/curCSS",
|
||||||
"./css/addGetHookIf",
|
|
||||||
"./css/support",
|
|
||||||
"./var/isWindow",
|
"./var/isWindow",
|
||||||
"./core/init",
|
"./core/init",
|
||||||
"./css",
|
"./css",
|
||||||
"./selector" // contains
|
"./selector" // contains
|
||||||
], function( jQuery, access, document, documentElement, isFunction, rnumnonpx,
|
], function( jQuery, access, document, documentElement, rnumnonpx, curCSS, isWindow ) {
|
||||||
curCSS, addGetHookIf, support, isWindow ) {
|
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
@ -47,7 +43,7 @@ jQuery.offset = {
|
|||||||
curLeft = parseFloat( curCSSLeft ) || 0;
|
curLeft = parseFloat( curCSSLeft ) || 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( isFunction( options ) ) {
|
if ( typeof options === "function" ) {
|
||||||
|
|
||||||
// Use jQuery.extend here to allow modification of coordinates argument (gh-1848)
|
// Use jQuery.extend here to allow modification of coordinates argument (gh-1848)
|
||||||
options = options.call( elem, i, jQuery.extend( {}, curOffset ) );
|
options = options.call( elem, i, jQuery.extend( {}, curOffset ) );
|
||||||
@ -91,7 +87,7 @@ jQuery.fn.extend( {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Return zeros for disconnected and hidden (display: none) elements (gh-2310)
|
// Return zeros for disconnected and hidden (display: none) elements (gh-2310)
|
||||||
// Support: IE <=11 only
|
// Support: IE <=11+
|
||||||
// Running getBoundingClientRect on a
|
// Running getBoundingClientRect on a
|
||||||
// disconnected node in IE throws an error
|
// disconnected node in IE throws an error
|
||||||
if ( !elem.getClientRects().length ) {
|
if ( !elem.getClientRects().length ) {
|
||||||
@ -208,26 +204,5 @@ jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function(
|
|||||||
};
|
};
|
||||||
} );
|
} );
|
||||||
|
|
||||||
// Support: Safari <=7 - 9.1, Chrome <=37 - 49
|
|
||||||
// Add the top/left cssHooks using jQuery.fn.position
|
|
||||||
// Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
|
|
||||||
// Blink bug: https://bugs.chromium.org/p/chromium/issues/detail?id=589347
|
|
||||||
// getComputedStyle returns percent when specified for top/left/bottom/right;
|
|
||||||
// rather than make the css module depend on the offset module, just check for it here
|
|
||||||
jQuery.each( [ "top", "left" ], function( i, prop ) {
|
|
||||||
jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition,
|
|
||||||
function( elem, computed ) {
|
|
||||||
if ( computed ) {
|
|
||||||
computed = curCSS( elem, prop );
|
|
||||||
|
|
||||||
// If curCSS returns percentage, fallback to offset
|
|
||||||
return rnumnonpx.test( computed ) ?
|
|
||||||
jQuery( elem ).position()[ prop ] + "px" :
|
|
||||||
computed;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
);
|
|
||||||
} );
|
|
||||||
|
|
||||||
return jQuery;
|
return jQuery;
|
||||||
} );
|
} );
|
||||||
|
@ -35,11 +35,10 @@ define( [
|
|||||||
|
|
||||||
var hasDuplicate, sortInput,
|
var hasDuplicate, sortInput,
|
||||||
sortStable = jQuery.expando.split( "" ).sort( sortOrder ).join( "" ) === jQuery.expando,
|
sortStable = jQuery.expando.split( "" ).sort( sortOrder ).join( "" ) === jQuery.expando,
|
||||||
matches = documentElement.matches ||
|
|
||||||
documentElement.webkitMatchesSelector ||
|
// Support: IE 9 - 11+
|
||||||
documentElement.mozMatchesSelector ||
|
// IE requires a prefix.
|
||||||
documentElement.oMatchesSelector ||
|
matches = documentElement.matches || documentElement.msMatchesSelector,
|
||||||
documentElement.msMatchesSelector,
|
|
||||||
|
|
||||||
// CSS string/identifier serialization
|
// CSS string/identifier serialization
|
||||||
// https://drafts.csswg.org/cssom/#common-serializing-idioms
|
// https://drafts.csswg.org/cssom/#common-serializing-idioms
|
||||||
|
@ -10,6 +10,7 @@ jQuery.expr = Sizzle.selectors;
|
|||||||
|
|
||||||
// Deprecated
|
// Deprecated
|
||||||
jQuery.expr[ ":" ] = jQuery.expr.pseudos;
|
jQuery.expr[ ":" ] = jQuery.expr.pseudos;
|
||||||
|
|
||||||
jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort;
|
jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort;
|
||||||
jQuery.text = Sizzle.getText;
|
jQuery.text = Sizzle.getText;
|
||||||
jQuery.isXMLDoc = Sizzle.isXML;
|
jQuery.isXMLDoc = Sizzle.isXML;
|
||||||
|
@ -2,11 +2,10 @@ define( [
|
|||||||
"./core",
|
"./core",
|
||||||
"./core/toType",
|
"./core/toType",
|
||||||
"./var/rcheckableType",
|
"./var/rcheckableType",
|
||||||
"./var/isFunction",
|
|
||||||
"./core/init",
|
"./core/init",
|
||||||
"./traversing", // filter
|
"./traversing", // filter
|
||||||
"./attributes/prop"
|
"./attributes/prop"
|
||||||
], function( jQuery, toType, rcheckableType, isFunction ) {
|
], function( jQuery, toType, rcheckableType ) {
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
@ -62,7 +61,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 = isFunction( valueOrFunction ) ?
|
var value = typeof valueOrFunction === "function" ?
|
||||||
valueOrFunction() :
|
valueOrFunction() :
|
||||||
valueOrFunction;
|
valueOrFunction;
|
||||||
|
|
||||||
|
@ -149,7 +149,7 @@ jQuery.each( {
|
|||||||
return elem.contentDocument;
|
return elem.contentDocument;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only
|
// Support: IE 9 - 11+
|
||||||
// Treat the template element as a regular one in browsers that
|
// Treat the template element as a regular one in browsers that
|
||||||
// don't support it.
|
// don't support it.
|
||||||
if ( nodeName( elem, "template" ) ) {
|
if ( nodeName( elem, "template" ) ) {
|
||||||
|
@ -1,16 +1,15 @@
|
|||||||
define( [
|
define( [
|
||||||
"../core",
|
"../core",
|
||||||
"../var/indexOf",
|
"../var/indexOf",
|
||||||
"../var/isFunction",
|
|
||||||
"./var/rneedsContext",
|
"./var/rneedsContext",
|
||||||
"../selector"
|
"../selector"
|
||||||
], function( jQuery, indexOf, isFunction, rneedsContext ) {
|
], function( jQuery, indexOf, rneedsContext ) {
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
// 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 ( isFunction( qualifier ) ) {
|
if ( typeof qualifier === "function" ) {
|
||||||
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;
|
||||||
} );
|
} );
|
||||||
|
@ -1,13 +0,0 @@
|
|||||||
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";
|
|
||||||
};
|
|
||||||
|
|
||||||
} );
|
|
5
src/var/trim.js
Normal file
5
src/var/trim.js
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
define( function() {
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
return "".trim;
|
||||||
|
} );
|
@ -1,10 +1,9 @@
|
|||||||
define( [
|
define( [
|
||||||
"./core",
|
"./core",
|
||||||
"./var/isFunction",
|
|
||||||
"./core/init",
|
"./core/init",
|
||||||
"./manipulation", // clone
|
"./manipulation", // clone
|
||||||
"./traversing" // parent, contents
|
"./traversing" // parent, contents
|
||||||
], function( jQuery, isFunction ) {
|
], function( jQuery ) {
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
@ -13,7 +12,7 @@ jQuery.fn.extend( {
|
|||||||
var wrap;
|
var wrap;
|
||||||
|
|
||||||
if ( this[ 0 ] ) {
|
if ( this[ 0 ] ) {
|
||||||
if ( isFunction( html ) ) {
|
if ( typeof html === "function" ) {
|
||||||
html = html.call( this[ 0 ] );
|
html = html.call( this[ 0 ] );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -39,7 +38,7 @@ jQuery.fn.extend( {
|
|||||||
},
|
},
|
||||||
|
|
||||||
wrapInner: function( html ) {
|
wrapInner: function( html ) {
|
||||||
if ( isFunction( html ) ) {
|
if ( typeof html === "function" ) {
|
||||||
return this.each( function( i ) {
|
return this.each( function( i ) {
|
||||||
jQuery( this ).wrapInner( html.call( this, i ) );
|
jQuery( this ).wrapInner( html.call( this, i ) );
|
||||||
} );
|
} );
|
||||||
@ -59,7 +58,7 @@ jQuery.fn.extend( {
|
|||||||
},
|
},
|
||||||
|
|
||||||
wrap: function( html ) {
|
wrap: function( html ) {
|
||||||
var htmlIsFunction = isFunction( html );
|
var htmlIsFunction = typeof html === "function";
|
||||||
|
|
||||||
return this.each( function( i ) {
|
return this.each( function( i ) {
|
||||||
jQuery( this ).wrapAll( htmlIsFunction ? html.call( this, i ) : html );
|
jQuery( this ).wrapAll( htmlIsFunction ? html.call( this, i ) : html );
|
||||||
|
@ -40,10 +40,6 @@
|
|||||||
// Pass this if window is not defined yet
|
// Pass this if window is not defined yet
|
||||||
} )( typeof window !== "undefined" ? window : this, function( window, noGlobal ) {
|
} )( typeof window !== "undefined" ? window : this, function( window, noGlobal ) {
|
||||||
|
|
||||||
// Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1
|
|
||||||
// throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode
|
|
||||||
// arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common
|
|
||||||
// enough that all such attempts are guarded in a try block.
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
// @CODE
|
// @CODE
|
||||||
|
@ -1,23 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
|
||||||
<script>
|
|
||||||
var cc_on = false,
|
|
||||||
errors = [];
|
|
||||||
/*@cc_on
|
|
||||||
cc_on = true;
|
|
||||||
@*/
|
|
||||||
window.onerror = function( errorMessage, filePath, lineNumber ) {
|
|
||||||
errors.push( errorMessage );
|
|
||||||
};
|
|
||||||
</script>
|
|
||||||
<script src="../../jquery.js"></script>
|
|
||||||
<script src="../iframeTest.js"></script>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<script>
|
|
||||||
startIframeTest( cc_on, errors );
|
|
||||||
</script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -1,5 +1,7 @@
|
|||||||
/* eslint no-multi-str: "off" */
|
/* eslint no-multi-str: "off" */
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
var FILEPATH = "/test/data/testinit.js",
|
var FILEPATH = "/test/data/testinit.js",
|
||||||
activeScript = [].slice.call( document.getElementsByTagName( "script" ), -1 )[ 0 ],
|
activeScript = [].slice.call( document.getElementsByTagName( "script" ), -1 )[ 0 ],
|
||||||
parentUrl = activeScript && activeScript.src ?
|
parentUrl = activeScript && activeScript.src ?
|
||||||
@ -100,43 +102,9 @@ this.createDashboardXML = function() {
|
|||||||
return jQuery.parseXML( string );
|
return jQuery.parseXML( string );
|
||||||
};
|
};
|
||||||
|
|
||||||
this.createWithFriesXML = function() {
|
|
||||||
var string = "<?xml version='1.0' encoding='UTF-8'?> \
|
|
||||||
<soap:Envelope xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/' \
|
|
||||||
xmlns:xsd='http://www.w3.org/2001/XMLSchema' \
|
|
||||||
xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'> \
|
|
||||||
<soap:Body> \
|
|
||||||
<jsconf xmlns='http://{{ externalHost }}/ns1'> \
|
|
||||||
<response xmlns:ab='http://{{ externalHost }}/ns2'> \
|
|
||||||
<meta> \
|
|
||||||
<component id='seite1' class='component'> \
|
|
||||||
<properties xmlns:cd='http://{{ externalHost }}/ns3'> \
|
|
||||||
<property name='prop1'> \
|
|
||||||
<thing /> \
|
|
||||||
<value>1</value> \
|
|
||||||
</property> \
|
|
||||||
<property name='prop2'> \
|
|
||||||
<thing att='something' /> \
|
|
||||||
</property> \
|
|
||||||
<foo_bar>foo</foo_bar> \
|
|
||||||
</properties> \
|
|
||||||
</component> \
|
|
||||||
</meta> \
|
|
||||||
</response> \
|
|
||||||
</jsconf> \
|
|
||||||
</soap:Body> \
|
|
||||||
</soap:Envelope>";
|
|
||||||
|
|
||||||
return jQuery.parseXML( string.replace( /\{\{\s*externalHost\s*\}\}/g, externalHost ) );
|
|
||||||
};
|
|
||||||
|
|
||||||
this.createXMLFragment = function() {
|
this.createXMLFragment = function() {
|
||||||
var xml, frag;
|
var frag,
|
||||||
if ( window.ActiveXObject ) {
|
|
||||||
xml = new window.ActiveXObject( "msxml2.domdocument" );
|
|
||||||
} else {
|
|
||||||
xml = document.implementation.createDocument( "", "", null );
|
xml = document.implementation.createDocument( "", "", null );
|
||||||
}
|
|
||||||
|
|
||||||
if ( xml ) {
|
if ( xml ) {
|
||||||
frag = xml.createElement( "data" );
|
frag = xml.createElement( "data" );
|
||||||
@ -314,10 +282,9 @@ this.loadTests = function() {
|
|||||||
require( [ parentUrl + "test/data/testrunner.js" ], function() {
|
require( [ parentUrl + "test/data/testrunner.js" ], function() {
|
||||||
var i = 0,
|
var i = 0,
|
||||||
tests = [
|
tests = [
|
||||||
// A special module with basic tests, meant for
|
// A special module with basic tests, meant for not fully
|
||||||
// not fully supported environments like Android 2.3,
|
// supported environments like jsdom. We run it everywhere,
|
||||||
// jsdom or PhantomJS. We run it everywhere, though,
|
// though, to make sure tests are not broken.
|
||||||
// to make sure tests are not broken.
|
|
||||||
"unit/basic.js",
|
"unit/basic.js",
|
||||||
|
|
||||||
"unit/core.js",
|
"unit/core.js",
|
||||||
@ -351,7 +318,6 @@ this.loadTests = function() {
|
|||||||
if ( !QUnit.basicTests || i === 1 ) {
|
if ( !QUnit.basicTests || i === 1 ) {
|
||||||
require( [ parentUrl + "test/" + dep ], loadDep );
|
require( [ parentUrl + "test/" + dep ], loadDep );
|
||||||
|
|
||||||
// Support: Android 2.3 only
|
|
||||||
// When running basic tests, replace other modules with dummies to avoid overloading
|
// When running basic tests, replace other modules with dummies to avoid overloading
|
||||||
// impaired clients.
|
// impaired clients.
|
||||||
} else {
|
} else {
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
( function() {
|
( function() {
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
// Store the old counts so that we only assert on tests that have actually leaked,
|
// Store the old counts so that we only assert on tests that have actually leaked,
|
||||||
// instead of asserting every time a test has leaked sometime in the past
|
// instead of asserting every time a test has leaked sometime in the past
|
||||||
var oldCacheLength = 0,
|
var oldCacheLength = 0,
|
||||||
|
@ -120,9 +120,7 @@ QUnit.module( "ajax", {
|
|||||||
assert.ok( true, "success" );
|
assert.ok( true, "success" );
|
||||||
},
|
},
|
||||||
fail: function() {
|
fail: function() {
|
||||||
if ( jQuery.support.cors === false ) {
|
assert.ok( false, "fail" );
|
||||||
assert.ok( true, "fail" );
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
complete: function() {
|
complete: function() {
|
||||||
assert.ok( true, "complete" );
|
assert.ok( true, "complete" );
|
||||||
@ -269,13 +267,12 @@ QUnit.module( "ajax", {
|
|||||||
"Nullable": null,
|
"Nullable": null,
|
||||||
"undefined": undefined
|
"undefined": undefined
|
||||||
|
|
||||||
// Support: IE 9 - 11, Edge 12 - 14 only
|
// Support: IE 9 - 11+, Edge 12 - 14 only
|
||||||
// Not all browsers allow empty-string headers
|
// Not all browsers allow empty-string headers
|
||||||
//"Empty": ""
|
//"Empty": ""
|
||||||
},
|
},
|
||||||
success: function( data, _, xhr ) {
|
success: function( data, _, xhr ) {
|
||||||
var i, emptyHeader,
|
var i, emptyHeader,
|
||||||
isAndroid = /android 4\.[0-3]/i.test( navigator.userAgent ),
|
|
||||||
requestHeaders = jQuery.extend( this.headers, {
|
requestHeaders = jQuery.extend( this.headers, {
|
||||||
"ajax-send": "test"
|
"ajax-send": "test"
|
||||||
} ),
|
} ),
|
||||||
@ -296,25 +293,8 @@ QUnit.module( "ajax", {
|
|||||||
assert.strictEqual( emptyHeader, "", "Empty header received" );
|
assert.strictEqual( emptyHeader, "", "Empty header received" );
|
||||||
}
|
}
|
||||||
assert.strictEqual( xhr.getResponseHeader( "Sample-Header2" ), "Hello World 2", "Second sample header received" );
|
assert.strictEqual( xhr.getResponseHeader( "Sample-Header2" ), "Hello World 2", "Second sample header received" );
|
||||||
|
|
||||||
if ( isAndroid ) {
|
|
||||||
// Support: Android 4.0-4.3 only
|
|
||||||
// Android Browser only returns the last value for each header
|
|
||||||
// so there's no way for jQuery get all parts.
|
|
||||||
assert.ok( true, "Android doesn't support repeated header names" );
|
|
||||||
} else {
|
|
||||||
assert.strictEqual( xhr.getResponseHeader( "List-Header" ), "Item 1, Item 2", "List header received" );
|
assert.strictEqual( xhr.getResponseHeader( "List-Header" ), "Item 1, Item 2", "List header received" );
|
||||||
}
|
|
||||||
|
|
||||||
if ( isAndroid && QUnit.isSwarm ) {
|
|
||||||
// Support: Android 4.0-4.3 on BrowserStack only
|
|
||||||
// Android Browser versions provided by BrowserStack fail this test
|
|
||||||
// while locally fired emulators don't, even when they connect
|
|
||||||
// to TestSwarm. Just skip the test there to avoid a red build.
|
|
||||||
assert.ok( true, "BrowserStack's Android fails the \"prototype collision (constructor)\" test" );
|
|
||||||
} else {
|
|
||||||
assert.strictEqual( xhr.getResponseHeader( "constructor" ), "prototype collision (constructor)", "constructor header received" );
|
assert.strictEqual( xhr.getResponseHeader( "constructor" ), "prototype collision (constructor)", "constructor header received" );
|
||||||
}
|
|
||||||
assert.strictEqual( xhr.getResponseHeader( "__proto__" ), null, "Undefined __proto__ header not received" );
|
assert.strictEqual( xhr.getResponseHeader( "__proto__" ), null, "Undefined __proto__ header not received" );
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -553,7 +533,6 @@ QUnit.module( "ajax", {
|
|||||||
};
|
};
|
||||||
} );
|
} );
|
||||||
|
|
||||||
if ( !/android 4\.0/i.test( navigator.userAgent ) ) {
|
|
||||||
ajaxTest( "jQuery.ajax() - native abort", 2, function( assert ) {
|
ajaxTest( "jQuery.ajax() - native abort", 2, function( assert ) {
|
||||||
return {
|
return {
|
||||||
url: url( "mock.php?action=wait&wait=1" ),
|
url: url( "mock.php?action=wait&wait=1" ),
|
||||||
@ -572,11 +551,7 @@ QUnit.module( "ajax", {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
} );
|
} );
|
||||||
}
|
|
||||||
|
|
||||||
// Support: Android <= 4.0 - 4.3 only
|
|
||||||
// Android 4.0-4.3 does not have ontimeout on an xhr
|
|
||||||
if ( "ontimeout" in new window.XMLHttpRequest() ) {
|
|
||||||
ajaxTest( "jQuery.ajax() - native timeout", 2, function( assert ) {
|
ajaxTest( "jQuery.ajax() - native timeout", 2, function( assert ) {
|
||||||
return {
|
return {
|
||||||
url: url( "mock.php?action=wait&wait=1" ),
|
url: url( "mock.php?action=wait&wait=1" ),
|
||||||
@ -593,7 +568,6 @@ QUnit.module( "ajax", {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
} );
|
} );
|
||||||
}
|
|
||||||
|
|
||||||
ajaxTest( "jQuery.ajax() - events with context", 12, function( assert ) {
|
ajaxTest( "jQuery.ajax() - events with context", 12, function( assert ) {
|
||||||
var context = document.createElement( "div" );
|
var context = document.createElement( "div" );
|
||||||
|
@ -179,7 +179,11 @@ QUnit.test( "manipulation", function( assert ) {
|
|||||||
".html getter/setter"
|
".html getter/setter"
|
||||||
);
|
);
|
||||||
|
|
||||||
assert.strictEqual( elem1.append( elem2 )[ 0 ].childNodes[ 1 ], elem2[ 0 ], ".append" );
|
assert.strictEqual(
|
||||||
|
elem1.append( elem2 )[ 0 ].childNodes[ elem1[ 0 ].childNodes.length - 1 ],
|
||||||
|
elem2[ 0 ],
|
||||||
|
".append"
|
||||||
|
);
|
||||||
assert.strictEqual( elem1.prepend( elem2 )[ 0 ].childNodes[ 0 ], elem2[ 0 ], ".prepend" );
|
assert.strictEqual( elem1.prepend( elem2 )[ 0 ].childNodes[ 0 ], elem2[ 0 ], ".prepend" );
|
||||||
|
|
||||||
child = elem1.find( "span" );
|
child = elem1.find( "span" );
|
||||||
|
@ -1319,7 +1319,6 @@ QUnit.test( "jQuery.parseHTML(<a href>) - gh-2965", function( assert ) {
|
|||||||
assert.ok( /\/example\.html$/.test( href ), "href is not lost after parsing anchor" );
|
assert.ok( /\/example\.html$/.test( href ), "href is not lost after parsing anchor" );
|
||||||
} );
|
} );
|
||||||
|
|
||||||
if ( jQuery.support.createHTMLDocument ) {
|
|
||||||
QUnit.test( "jQuery.parseHTML", function( assert ) {
|
QUnit.test( "jQuery.parseHTML", function( assert ) {
|
||||||
var done = assert.async();
|
var done = assert.async();
|
||||||
assert.expect( 1 );
|
assert.expect( 1 );
|
||||||
@ -1334,7 +1333,6 @@ if ( jQuery.support.createHTMLDocument ) {
|
|||||||
done();
|
done();
|
||||||
}, 2000 );
|
}, 2000 );
|
||||||
} );
|
} );
|
||||||
}
|
|
||||||
|
|
||||||
QUnit.test( "jQuery.parseXML", function( assert ) {
|
QUnit.test( "jQuery.parseXML", function( assert ) {
|
||||||
assert.expect( 8 );
|
assert.expect( 8 );
|
||||||
@ -1370,21 +1368,6 @@ QUnit.test( "jQuery.parseXML", function( assert ) {
|
|||||||
}
|
}
|
||||||
} );
|
} );
|
||||||
|
|
||||||
testIframe(
|
|
||||||
"Conditional compilation compatibility (#13274)",
|
|
||||||
"core/cc_on.html",
|
|
||||||
function( assert, jQuery, window, document, cc_on, errors ) {
|
|
||||||
assert.expect( 3 );
|
|
||||||
assert.ok( true, "JScript conditional compilation " + ( cc_on ? "supported" : "not supported" ) );
|
|
||||||
assert.deepEqual( errors, [], "No errors" );
|
|
||||||
assert.ok( jQuery(), "jQuery executes" );
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
// iOS7 doesn't fire the load event if the long-loading iframe gets its source reset to about:blank.
|
|
||||||
// This makes this test fail but it doesn't seem to cause any real-life problems so blacklisting
|
|
||||||
// this test there is preferred to complicating the hard-to-test core/ready code further.
|
|
||||||
if ( !/iphone os 7_/i.test( navigator.userAgent ) ) {
|
|
||||||
testIframe(
|
testIframe(
|
||||||
"document ready when jQuery loaded asynchronously (#13655)",
|
"document ready when jQuery loaded asynchronously (#13655)",
|
||||||
"core/dynamic_ready.html",
|
"core/dynamic_ready.html",
|
||||||
@ -1393,7 +1376,6 @@ if ( !/iphone os 7_/i.test( navigator.userAgent ) ) {
|
|||||||
assert.equal( true, ready, "document ready correctly fired when jQuery is loaded after DOMContentLoaded" );
|
assert.equal( true, ready, "document ready correctly fired when jQuery is loaded after DOMContentLoaded" );
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
|
||||||
|
|
||||||
testIframe(
|
testIframe(
|
||||||
"Tolerating alias-masked DOM properties (#14074)",
|
"Tolerating alias-masked DOM properties (#14074)",
|
||||||
|
@ -641,7 +641,7 @@ QUnit.test( "show/hide detached nodes", function( assert ) {
|
|||||||
span.remove();
|
span.remove();
|
||||||
} );
|
} );
|
||||||
|
|
||||||
QUnit[ document.body.attachShadow ? "test" : "skip" ]( "show/hide shadow child nodes", function( assert ) {
|
QUnit[ document.body.getRootNode ? "test" : "skip" ]( "show/hide shadow child nodes", function( assert ) {
|
||||||
assert.expect( 28 );
|
assert.expect( 28 );
|
||||||
jQuery( "<div id='shadowHost'></div>" ).appendTo( "#qunit-fixture" );
|
jQuery( "<div id='shadowHost'></div>" ).appendTo( "#qunit-fixture" );
|
||||||
var shadowHost = document.querySelector( "#shadowHost" );
|
var shadowHost = document.querySelector( "#shadowHost" );
|
||||||
@ -1023,7 +1023,7 @@ QUnit[ jQuery.find.compile && jQuery.fn.toggle ? "test" : "skip" ]( "detached to
|
|||||||
"cascade-hidden element in detached tree" );
|
"cascade-hidden element in detached tree" );
|
||||||
} );
|
} );
|
||||||
|
|
||||||
QUnit[ jQuery.find.compile && jQuery.fn.toggle && document.body.attachShadow ? "test" : "skip" ]( "shadow toggle()", function( assert ) {
|
QUnit[ jQuery.find.compile && jQuery.fn.toggle && document.body.getRootNode ? "test" : "skip" ]( "shadow toggle()", function( assert ) {
|
||||||
assert.expect( 4 );
|
assert.expect( 4 );
|
||||||
jQuery( "<div id='shadowHost'></div>" ).appendTo( "#qunit-fixture" );
|
jQuery( "<div id='shadowHost'></div>" ).appendTo( "#qunit-fixture" );
|
||||||
var shadowHost = document.querySelector( "#shadowHost" );
|
var shadowHost = document.querySelector( "#shadowHost" );
|
||||||
@ -1420,16 +1420,6 @@ QUnit.test( "certain css values of 'normal' should be convertable to a number, s
|
|||||||
assert.equal( typeof el.css( "fontWeight" ), "string", ".css() returns a string" );
|
assert.equal( typeof el.css( "fontWeight" ), "string", ".css() returns a string" );
|
||||||
} );
|
} );
|
||||||
|
|
||||||
// Support: IE 9 only
|
|
||||||
// Only run this test in IE9
|
|
||||||
if ( document.documentMode === 9 ) {
|
|
||||||
QUnit.test( ".css('filter') returns a string in IE9, see #12537", function( assert ) {
|
|
||||||
assert.expect( 1 );
|
|
||||||
|
|
||||||
assert.equal( jQuery( "<div style='-ms-filter:\"progid:DXImageTransform.Microsoft.gradient(startColorstr=#FFFFFF, endColorstr=#ECECEC)\";'></div>" ).css( "filter" ), "progid:DXImageTransform.Microsoft.gradient(startColorstr=#FFFFFF, endColorstr=#ECECEC)", "IE9 returns the correct value from css('filter')." );
|
|
||||||
} );
|
|
||||||
}
|
|
||||||
|
|
||||||
QUnit.test( "cssHooks - expand", function( assert ) {
|
QUnit.test( "cssHooks - expand", function( assert ) {
|
||||||
assert.expect( 15 );
|
assert.expect( 15 );
|
||||||
var result,
|
var result,
|
||||||
@ -1489,9 +1479,9 @@ QUnit.test( "css opacity consistency across browsers (#12685)", function( assert
|
|||||||
} );
|
} );
|
||||||
|
|
||||||
QUnit[ jQuery.find.compile ? "test" : "skip" ]( ":visible/:hidden selectors", function( assert ) {
|
QUnit[ jQuery.find.compile ? "test" : "skip" ]( ":visible/:hidden selectors", function( assert ) {
|
||||||
assert.expect( 17 );
|
assert.expect( 18 );
|
||||||
|
|
||||||
var $div, $table, $a;
|
var $div, $table, $a, $br;
|
||||||
|
|
||||||
assert.ok( jQuery( "#nothiddendiv" ).is( ":visible" ), "Modifying CSS display: Assert element is visible" );
|
assert.ok( jQuery( "#nothiddendiv" ).is( ":visible" ), "Modifying CSS display: Assert element is visible" );
|
||||||
jQuery( "#nothiddendiv" ).css( { display: "none" } );
|
jQuery( "#nothiddendiv" ).css( { display: "none" } );
|
||||||
@ -1513,10 +1503,8 @@ QUnit[ jQuery.find.compile ? "test" : "skip" ]( ":visible/:hidden selectors", fu
|
|||||||
$div.css( { width: 0, height: 0, overflow: "hidden" } );
|
$div.css( { width: 0, height: 0, overflow: "hidden" } );
|
||||||
assert.ok( $div.is( ":visible" ), "Div with width and height of 0 is still visible (gh-2227)" );
|
assert.ok( $div.is( ":visible" ), "Div with width and height of 0 is still visible (gh-2227)" );
|
||||||
|
|
||||||
// Safari 6-7 and iOS 6-7 report 0 width for br elements
|
$br = jQuery( "<br/>" ).appendTo( "#qunit-fixture" );
|
||||||
// When newer browsers propagate, re-enable this test
|
assert.ok( $br.is( ":visible" ), "br element is visible" );
|
||||||
// $br = jQuery( "<br/>" ).appendTo( "#qunit-fixture" );
|
|
||||||
// assert.ok( $br.is( ":visible" ), "br element is visible" );
|
|
||||||
|
|
||||||
$table = jQuery( "#table" );
|
$table = jQuery( "#table" );
|
||||||
$table.html( "<tr><td style='display:none'>cell</td><td>cell</td></tr>" );
|
$table.html( "<tr><td style='display:none'>cell</td><td>cell</td></tr>" );
|
||||||
@ -1539,11 +1527,7 @@ QUnit.test( "Keep the last style if the new one isn't recognized by the browser
|
|||||||
assert.equal( el.css( "position" ), "absolute", "The old style is kept when setting an unrecognized value" );
|
assert.equal( el.css( "position" ), "absolute", "The old style is kept when setting an unrecognized value" );
|
||||||
} );
|
} );
|
||||||
|
|
||||||
// Support: Edge 14 - 16 only
|
QUnit.test(
|
||||||
// Edge collapses whitespace-only values when setting a style property and
|
|
||||||
// there is no easy way for us to work around it. Just skip the test there
|
|
||||||
// and hope for the better future.
|
|
||||||
QUnit[ /\bedge\/16\./i.test( navigator.userAgent ) ? "skip" : "test" ](
|
|
||||||
"Keep the last style if the new one is a non-empty whitespace (gh-3204)",
|
"Keep the last style if the new one is a non-empty whitespace (gh-3204)",
|
||||||
function( assert ) {
|
function( assert ) {
|
||||||
assert.expect( 1 );
|
assert.expect( 1 );
|
||||||
@ -1648,15 +1632,6 @@ QUnit.test(
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
// Support: IE <=10 only
|
|
||||||
// We have to jump through the hoops here in order to test work with "order" CSS property,
|
|
||||||
// that some browsers do not support. This test is not, strictly speaking, correct,
|
|
||||||
// but it's the best that we can do.
|
|
||||||
( function() {
|
|
||||||
var style = document.createElement( "div" ).style,
|
|
||||||
exist = "order" in style || "WebkitOrder" in style;
|
|
||||||
|
|
||||||
if ( exist ) {
|
|
||||||
QUnit.test( "Don't append px to CSS \"order\" value (#14049)", function( assert ) {
|
QUnit.test( "Don't append px to CSS \"order\" value (#14049)", function( assert ) {
|
||||||
assert.expect( 1 );
|
assert.expect( 1 );
|
||||||
|
|
||||||
@ -1665,8 +1640,6 @@ QUnit.test(
|
|||||||
$elem.css( "order", 2 );
|
$elem.css( "order", 2 );
|
||||||
assert.equal( $elem.css( "order" ), "2", "2 on order" );
|
assert.equal( $elem.css( "order" ), "2", "2 on order" );
|
||||||
} );
|
} );
|
||||||
}
|
|
||||||
} )();
|
|
||||||
|
|
||||||
QUnit.test( "Do not throw on frame elements from css method (#15098)", function( assert ) {
|
QUnit.test( "Do not throw on frame elements from css method (#15098)", function( assert ) {
|
||||||
assert.expect( 1 );
|
assert.expect( 1 );
|
||||||
@ -1788,18 +1761,12 @@ QUnit.test( "Do not throw on frame elements from css method (#15098)", function(
|
|||||||
var div = jQuery( "<div>" ).appendTo( "#qunit-fixture" ),
|
var div = jQuery( "<div>" ).appendTo( "#qunit-fixture" ),
|
||||||
$elem = jQuery( "<div>" ).addClass( "test__customProperties" )
|
$elem = jQuery( "<div>" ).addClass( "test__customProperties" )
|
||||||
.appendTo( "#qunit-fixture" ),
|
.appendTo( "#qunit-fixture" ),
|
||||||
webkit = /\bsafari\b/i.test( navigator.userAgent ) &&
|
webkitOrBlink = /\bsafari\b/i.test( navigator.userAgent ) &&
|
||||||
!/\firefox\b/i.test( navigator.userAgent ) &&
|
!/\bfirefox\b/i.test( navigator.userAgent ) &&
|
||||||
!/\edge\b/i.test( navigator.userAgent ),
|
!/\bedge\b/i.test( navigator.userAgent ),
|
||||||
oldSafari = webkit && ( /\b9\.\d(\.\d+)* safari/i.test( navigator.userAgent ) ||
|
|
||||||
/\b10\.0(\.\d+)* safari/i.test( navigator.userAgent ) ||
|
|
||||||
/iphone os (?:9|10)_/i.test( navigator.userAgent ) ),
|
|
||||||
expected = 10;
|
expected = 10;
|
||||||
|
|
||||||
if ( webkit ) {
|
if ( webkitOrBlink ) {
|
||||||
expected -= 2;
|
|
||||||
}
|
|
||||||
if ( oldSafari ) {
|
|
||||||
expected -= 2;
|
expected -= 2;
|
||||||
}
|
}
|
||||||
assert.expect( expected );
|
assert.expect( expected );
|
||||||
@ -1825,17 +1792,13 @@ QUnit.test( "Do not throw on frame elements from css method (#15098)", function(
|
|||||||
|
|
||||||
assert.equal( $elem.css( "--prop1" ), "val1", "Basic CSS custom property" );
|
assert.equal( $elem.css( "--prop1" ), "val1", "Basic CSS custom property" );
|
||||||
|
|
||||||
// Support: Safari 9.1-10.0 only
|
|
||||||
// Safari collapses whitespaces & quotes. Ignore it.
|
|
||||||
if ( !oldSafari ) {
|
|
||||||
assert.equal( $elem.css( "--prop2" ), " val2", "Preceding whitespace maintained" );
|
assert.equal( $elem.css( "--prop2" ), " val2", "Preceding whitespace maintained" );
|
||||||
assert.equal( $elem.css( "--prop3" ), "val3 ", "Following whitespace maintained" );
|
assert.equal( $elem.css( "--prop3" ), "val3 ", "Following whitespace maintained" );
|
||||||
}
|
|
||||||
|
|
||||||
// Support: Chrome 49-55, Safari 9.1-10.0
|
// Support: Chrome <=49 - 73+, Safari <=9.1 - 12.1+
|
||||||
// Chrome treats single quotes as double ones.
|
// Chrome treats single quotes as double ones.
|
||||||
// Safari treats double quotes as single ones.
|
// Safari treats double quotes as single ones.
|
||||||
if ( !webkit ) {
|
if ( !webkitOrBlink ) {
|
||||||
assert.equal( $elem.css( "--prop4" ), "\"val4\"", "Works with double quotes" );
|
assert.equal( $elem.css( "--prop4" ), "\"val4\"", "Works with double quotes" );
|
||||||
assert.equal( $elem.css( "--prop5" ), "'val5'", "Works with single quotes" );
|
assert.equal( $elem.css( "--prop5" ), "'val5'", "Works with single quotes" );
|
||||||
}
|
}
|
||||||
|
@ -172,7 +172,7 @@ QUnit.test( "jQuery.Deferred.catch", function( assert ) {
|
|||||||
|
|
||||||
var value1, value2, value3,
|
var value1, value2, value3,
|
||||||
defer = jQuery.Deferred(),
|
defer = jQuery.Deferred(),
|
||||||
piped = defer[ "catch" ]( function( a, b ) {
|
piped = defer.catch( function( a, b ) {
|
||||||
return a * b;
|
return a * b;
|
||||||
} ),
|
} ),
|
||||||
done = jQuery.map( new Array( 3 ), function() { return assert.async(); } );
|
done = jQuery.map( new Array( 3 ), function() { return assert.async(); } );
|
||||||
@ -186,18 +186,18 @@ QUnit.test( "jQuery.Deferred.catch", function( assert ) {
|
|||||||
value2 = b;
|
value2 = b;
|
||||||
} );
|
} );
|
||||||
|
|
||||||
defer.reject( 2, 3 )[ "catch" ]( function() {
|
defer.reject( 2, 3 ).catch( function() {
|
||||||
assert.strictEqual( value1, 2, "first reject value ok" );
|
assert.strictEqual( value1, 2, "first reject value ok" );
|
||||||
assert.strictEqual( value2, 3, "second reject value ok" );
|
assert.strictEqual( value2, 3, "second reject value ok" );
|
||||||
assert.strictEqual( value3, 6, "result of filter ok" );
|
assert.strictEqual( value3, 6, "result of filter ok" );
|
||||||
done.pop().call();
|
done.pop().call();
|
||||||
} );
|
} );
|
||||||
|
|
||||||
jQuery.Deferred().resolve()[ "catch" ]( function() {
|
jQuery.Deferred().resolve().catch( function() {
|
||||||
assert.ok( false, "then should not be called on resolve" );
|
assert.ok( false, "then should not be called on resolve" );
|
||||||
} ).then( done.pop() );
|
} ).then( done.pop() );
|
||||||
|
|
||||||
jQuery.Deferred().reject()[ "catch" ]( jQuery.noop ).done( function( value ) {
|
jQuery.Deferred().reject().catch( jQuery.noop ).done( function( value ) {
|
||||||
assert.strictEqual( value, undefined, "then fail callback can return undefined/null" );
|
assert.strictEqual( value, undefined, "then fail callback can return undefined/null" );
|
||||||
done.pop().call();
|
done.pop().call();
|
||||||
} );
|
} );
|
||||||
@ -563,8 +563,7 @@ QUnit[ typeof Symbol === "function" && Symbol.toStringTag ? "test" : "skip" ](
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
// Test fails in IE9 but is skipped there because console is not active
|
QUnit.test( "jQuery.Deferred.exceptionHook", function( assert ) {
|
||||||
QUnit[ window.console ? "test" : "skip" ]( "jQuery.Deferred.exceptionHook", function( assert ) {
|
|
||||||
|
|
||||||
assert.expect( 2 );
|
assert.expect( 2 );
|
||||||
|
|
||||||
@ -573,24 +572,10 @@ QUnit[ window.console ? "test" : "skip" ]( "jQuery.Deferred.exceptionHook", func
|
|||||||
oldWarn = window.console.warn;
|
oldWarn = window.console.warn;
|
||||||
|
|
||||||
window.console.warn = function() {
|
window.console.warn = function() {
|
||||||
|
var msg = Array.prototype.join.call( arguments, " " );
|
||||||
// Support: Chrome <=41 only
|
|
||||||
// Some Chrome versions newer than 30 but older than 42 display the "undefined is
|
|
||||||
// not a function" error, not mentioning the function name. This has been fixed
|
|
||||||
// in Chrome 42. Relax this test there.
|
|
||||||
// This affects our Android 5.0 & Yandex.Browser testing.
|
|
||||||
var msg = Array.prototype.join.call( arguments, " " ),
|
|
||||||
oldChromium = false;
|
|
||||||
if ( /chrome/i.test( navigator.userAgent ) ) {
|
|
||||||
oldChromium = parseInt(
|
|
||||||
navigator.userAgent.match( /chrome\/(\d+)/i )[ 1 ], 10 ) < 42;
|
|
||||||
}
|
|
||||||
if ( oldChromium ) {
|
|
||||||
assert.ok( /(?:barf|undefined)/.test( msg ), "Message (weak assertion): " + msg );
|
|
||||||
} else {
|
|
||||||
assert.ok( /barf/.test( msg ), "Message: " + msg );
|
assert.ok( /barf/.test( msg ), "Message: " + msg );
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
jQuery.when(
|
jQuery.when(
|
||||||
defer.then( function() {
|
defer.then( function() {
|
||||||
|
|
||||||
@ -613,8 +598,7 @@ QUnit[ window.console ? "test" : "skip" ]( "jQuery.Deferred.exceptionHook", func
|
|||||||
defer.resolve();
|
defer.resolve();
|
||||||
} );
|
} );
|
||||||
|
|
||||||
// Test fails in IE9 but is skipped there because console is not active
|
QUnit.test( "jQuery.Deferred.exceptionHook with stack hooks", function( assert ) {
|
||||||
QUnit[ window.console ? "test" : "skip" ]( "jQuery.Deferred.exceptionHook with stack hooks", function( assert ) {
|
|
||||||
|
|
||||||
assert.expect( 2 );
|
assert.expect( 2 );
|
||||||
|
|
||||||
@ -632,26 +616,11 @@ QUnit[ window.console ? "test" : "skip" ]( "jQuery.Deferred.exceptionHook with s
|
|||||||
};
|
};
|
||||||
|
|
||||||
window.console.warn = function() {
|
window.console.warn = function() {
|
||||||
|
var msg = Array.prototype.join.call( arguments, " " );
|
||||||
// Support: Chrome <=41 only
|
|
||||||
// Some Chrome versions newer than 30 but older than 42 display the "undefined is
|
|
||||||
// not a function" error, not mentioning the function name. This has been fixed
|
|
||||||
// in Chrome 42. Relax this test there.
|
|
||||||
// This affects our Android 5.0 & Yandex.Browser testing.
|
|
||||||
var msg = Array.prototype.join.call( arguments, " " ),
|
|
||||||
oldChromium = false;
|
|
||||||
if ( /chrome/i.test( navigator.userAgent ) ) {
|
|
||||||
oldChromium = parseInt(
|
|
||||||
navigator.userAgent.match( /chrome\/(\d+)/i )[ 1 ], 10 ) < 42;
|
|
||||||
}
|
|
||||||
if ( oldChromium ) {
|
|
||||||
assert.ok( /(?:cough_up_hairball|undefined)/.test( msg ),
|
|
||||||
"Function mentioned (weak assertion): " + msg );
|
|
||||||
} else {
|
|
||||||
assert.ok( /cough_up_hairball/.test( msg ), "Function mentioned: " + msg );
|
assert.ok( /cough_up_hairball/.test( msg ), "Function mentioned: " + msg );
|
||||||
}
|
|
||||||
assert.ok( /NO STACK FOR YOU/.test( msg ), "Stack trace included: " + msg );
|
assert.ok( /NO STACK FOR YOU/.test( msg ), "Stack trace included: " + msg );
|
||||||
};
|
};
|
||||||
|
|
||||||
defer.then( function() {
|
defer.then( function() {
|
||||||
jQuery.cough_up_hairball();
|
jQuery.cough_up_hairball();
|
||||||
} ).then( null, function( ) {
|
} ).then( null, function( ) {
|
||||||
@ -825,11 +794,7 @@ QUnit.test( "jQuery.when(nonThenable) - like Promise.resolve", function( assert
|
|||||||
|
|
||||||
assert.expect( 44 );
|
assert.expect( 44 );
|
||||||
|
|
||||||
var
|
var defaultContext = ( function getDefaultContext() { return this; } )(),
|
||||||
|
|
||||||
// Support: Android 4.0 only
|
|
||||||
// Strict mode functions invoked without .call/.apply get global-object context
|
|
||||||
defaultContext = ( function getDefaultContext() { return this; } ).call(),
|
|
||||||
|
|
||||||
done = assert.async( 20 );
|
done = assert.async( 20 );
|
||||||
|
|
||||||
@ -884,9 +849,7 @@ QUnit.test( "jQuery.when(thenable) - like Promise.resolve", function( assert ) {
|
|||||||
|
|
||||||
var customToStringThen = {
|
var customToStringThen = {
|
||||||
then: function( onFulfilled ) {
|
then: function( onFulfilled ) {
|
||||||
// Support: Android 4.0 only
|
onFulfilled();
|
||||||
// Strict mode functions invoked without .call/.apply get global-object context
|
|
||||||
onFulfilled.call();
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
if ( typeof Symbol === "function" ) {
|
if ( typeof Symbol === "function" ) {
|
||||||
@ -947,9 +910,7 @@ QUnit.test( "jQuery.when(thenable) - like Promise.resolve", function( assert ) {
|
|||||||
},
|
},
|
||||||
numCases = Object.keys( willSucceed ).length + Object.keys( willError ).length,
|
numCases = Object.keys( willSucceed ).length + Object.keys( willError ).length,
|
||||||
|
|
||||||
// Support: Android 4.0 only
|
defaultContext = ( function getDefaultContext() { return this; } )(),
|
||||||
// Strict mode functions invoked without .call/.apply get global-object context
|
|
||||||
defaultContext = ( function getDefaultContext() { return this; } ).call(),
|
|
||||||
|
|
||||||
done = assert.async( numCases * 2 );
|
done = assert.async( numCases * 2 );
|
||||||
|
|
||||||
@ -1027,9 +988,7 @@ QUnit.test( "jQuery.when(a, b) - like Promise.all", function( assert ) {
|
|||||||
rejectedStandardPromise: true
|
rejectedStandardPromise: true
|
||||||
},
|
},
|
||||||
|
|
||||||
// Support: Android 4.0 only
|
defaultContext = ( function getDefaultContext() { return this; } )(),
|
||||||
// Strict mode functions invoked without .call/.apply get global-object context
|
|
||||||
defaultContext = ( function getDefaultContext() { return this; } ).call(),
|
|
||||||
|
|
||||||
done = assert.async( 98 );
|
done = assert.async( 98 );
|
||||||
|
|
||||||
|
@ -687,19 +687,7 @@ QUnit.test( "interaction with scrollbars (gh-3589)", function( assert ) {
|
|||||||
.css( { position: "relative" } ),
|
.css( { position: "relative" } ),
|
||||||
$boxes = jQuery(
|
$boxes = jQuery(
|
||||||
[ plainBox[ 0 ], contentBox[ 0 ], borderBox[ 0 ], relativeBorderBox[ 0 ] ]
|
[ plainBox[ 0 ], contentBox[ 0 ], borderBox[ 0 ], relativeBorderBox[ 0 ] ]
|
||||||
).appendTo( parent ),
|
).appendTo( parent );
|
||||||
|
|
||||||
// Support: IE 9 only
|
|
||||||
// Computed width seems to report content width even with "box-sizing: border-box", and
|
|
||||||
// "overflow: scroll" actually _shrinks_ the element (gh-3699).
|
|
||||||
borderBoxLoss =
|
|
||||||
borderBox.clone().css( { overflow: "auto" } ).appendTo( parent )[ 0 ].offsetWidth -
|
|
||||||
borderBox[ 0 ].offsetWidth;
|
|
||||||
|
|
||||||
if ( borderBoxLoss > 0 ) {
|
|
||||||
borderBox[ 0 ].style.width = ( size + borderBoxLoss ) + "px";
|
|
||||||
borderBox[ 0 ].style.height = ( size + borderBoxLoss ) + "px";
|
|
||||||
}
|
|
||||||
|
|
||||||
for ( i = 0; i < 3; i++ ) {
|
for ( i = 0; i < 3; i++ ) {
|
||||||
if ( i === 1 ) {
|
if ( i === 1 ) {
|
||||||
@ -758,10 +746,9 @@ QUnit.test( "outerWidth/Height for table cells and textarea with border-box in I
|
|||||||
$secondTh = jQuery( "<th style='width: 190px;padding: 5px' />" ),
|
$secondTh = jQuery( "<th style='width: 190px;padding: 5px' />" ),
|
||||||
$thirdTh = jQuery( "<th style='width: 180px;padding: 5px' />" ),
|
$thirdTh = jQuery( "<th style='width: 180px;padding: 5px' />" ),
|
||||||
|
|
||||||
// Support: Firefox 63, Edge 16-17, Android 8, iOS 7-11
|
// Most browsers completely ignore the border-box and height settings.
|
||||||
// These browsers completely ignore the border-box and height settings
|
// The computed height is instead just line-height + border.
|
||||||
// The computed height is instead just line-height + border
|
// Either way, what we're doing in css.js is correct.
|
||||||
// Either way, what we're doing in css.js is correct
|
|
||||||
$td = jQuery( "<td style='height: 20px;padding: 5px;border: 1px solid;line-height:18px'>text</td>" ),
|
$td = jQuery( "<td style='height: 20px;padding: 5px;border: 1px solid;line-height:18px'>text</td>" ),
|
||||||
|
|
||||||
$tbody = jQuery( "<tbody />" ).appendTo( $table ),
|
$tbody = jQuery( "<tbody />" ).appendTo( $table ),
|
||||||
@ -775,18 +762,7 @@ QUnit.test( "outerWidth/Height for table cells and textarea with border-box in I
|
|||||||
assert.strictEqual( $firstTh.outerWidth(), 200, "First th has outerWidth 200." );
|
assert.strictEqual( $firstTh.outerWidth(), 200, "First th has outerWidth 200." );
|
||||||
assert.strictEqual( $secondTh.outerWidth(), 200, "Second th has outerWidth 200." );
|
assert.strictEqual( $secondTh.outerWidth(), 200, "Second th has outerWidth 200." );
|
||||||
assert.strictEqual( $thirdTh.outerWidth(), 200, "Third th has outerWidth 200." );
|
assert.strictEqual( $thirdTh.outerWidth(), 200, "Third th has outerWidth 200." );
|
||||||
|
|
||||||
// Support: Android 4.0-4.3 only
|
|
||||||
// Android Browser disregards td's box-sizing, treating it like it was content-box.
|
|
||||||
// Unlike in IE, offsetHeight shares the same issue so there's no easy way to workaround
|
|
||||||
// the issue without incurring high size penalty. Let's at least check we get the size
|
|
||||||
// as the browser sees it.
|
|
||||||
if ( /android 4\.[0-3]/i.test( navigator.userAgent ) ) {
|
|
||||||
assert.ok( [ 30, 32 ].indexOf( $td.outerHeight() ) > -1,
|
|
||||||
"outerHeight of td with border-box should include padding." );
|
|
||||||
} else {
|
|
||||||
assert.strictEqual( $td.outerHeight(), 30, "outerHeight of td with border-box should include padding." );
|
assert.strictEqual( $td.outerHeight(), 30, "outerHeight of td with border-box should include padding." );
|
||||||
}
|
|
||||||
assert.strictEqual( $textarea.outerHeight(), 6, "outerHeight of textarea with border-box should include padding and border." );
|
assert.strictEqual( $textarea.outerHeight(), 6, "outerHeight of textarea with border-box should include padding and border." );
|
||||||
} );
|
} );
|
||||||
|
|
||||||
|
13
test/unit/effects.js
vendored
13
test/unit/effects.js
vendored
@ -221,7 +221,7 @@ supportjQuery.each( hideOptions, function( type, setup ) {
|
|||||||
assert.expectJqData( this, $span, "olddisplay" );
|
assert.expectJqData( this, $span, "olddisplay" );
|
||||||
} );
|
} );
|
||||||
|
|
||||||
QUnit[ document.body.attachShadow ? "test" : "skip" ](
|
QUnit[ document.body.getRootNode ? "test" : "skip" ](
|
||||||
"Persist correct display value - " + type + " hidden, shadow child", function( assert ) {
|
"Persist correct display value - " + type + " hidden, shadow child", function( assert ) {
|
||||||
assert.expect( 3 );
|
assert.expect( 3 );
|
||||||
|
|
||||||
@ -690,15 +690,7 @@ QUnit.test( "stop()", function( assert ) {
|
|||||||
this.clock.tick( 100 );
|
this.clock.tick( 100 );
|
||||||
} );
|
} );
|
||||||
|
|
||||||
// In IE9 inside testswarm this test doesn't work properly
|
QUnit.test( "stop() - several in queue", function( assert ) {
|
||||||
( function() {
|
|
||||||
var type = "test";
|
|
||||||
|
|
||||||
if ( QUnit.isSwarm && /msie 9\.0/i.test( window.navigator.userAgent ) ) {
|
|
||||||
type = "skip";
|
|
||||||
}
|
|
||||||
|
|
||||||
QUnit[ type ]( "stop() - several in queue", function( assert ) {
|
|
||||||
assert.expect( 5 );
|
assert.expect( 5 );
|
||||||
|
|
||||||
var nw, $foo = jQuery( "#foo" );
|
var nw, $foo = jQuery( "#foo" );
|
||||||
@ -727,7 +719,6 @@ QUnit.test( "stop()", function( assert ) {
|
|||||||
|
|
||||||
assert.equal( $foo.queue().length, 0, "0 in the queue" );
|
assert.equal( $foo.queue().length, 0, "0 in the queue" );
|
||||||
} );
|
} );
|
||||||
} )();
|
|
||||||
|
|
||||||
QUnit.test( "stop(clearQueue)", function( assert ) {
|
QUnit.test( "stop(clearQueue)", function( assert ) {
|
||||||
assert.expect( 4 );
|
assert.expect( 4 );
|
||||||
|
@ -1414,7 +1414,7 @@ QUnit.test( "Submit event can be stopped (#11049)", function( assert ) {
|
|||||||
form.remove();
|
form.remove();
|
||||||
} );
|
} );
|
||||||
|
|
||||||
// Support: iOS 7 - 9
|
// Support: iOS <=7 - 12+
|
||||||
// iOS has the window.onbeforeunload field but doesn't support the beforeunload
|
// iOS has the window.onbeforeunload field but doesn't support the beforeunload
|
||||||
// handler making it impossible to feature-detect the support.
|
// handler making it impossible to feature-detect the support.
|
||||||
QUnit[ /(ipad|iphone|ipod)/i.test( navigator.userAgent ) ? "skip" : "test" ](
|
QUnit[ /(ipad|iphone|ipod)/i.test( navigator.userAgent ) ? "skip" : "test" ](
|
||||||
@ -2434,7 +2434,7 @@ QUnit.test( "event object properties on natively-triggered event", function( ass
|
|||||||
$link = jQuery( link ),
|
$link = jQuery( link ),
|
||||||
evt = document.createEvent( "MouseEvents" );
|
evt = document.createEvent( "MouseEvents" );
|
||||||
|
|
||||||
// Support: IE <=9 - 11 only
|
// Support: IE <=9 - 11+
|
||||||
// IE requires element to be in the body before it will dispatch
|
// IE requires element to be in the body before it will dispatch
|
||||||
$link.appendTo( "body" ).on( "click", function( e ) {
|
$link.appendTo( "body" ).on( "click", function( e ) {
|
||||||
|
|
||||||
@ -2931,21 +2931,6 @@ QUnit.test( "trigger('click') on radio passes extra params", function( assert )
|
|||||||
$radio.trigger( "click", [ true ] );
|
$radio.trigger( "click", [ true ] );
|
||||||
} );
|
} );
|
||||||
|
|
||||||
// Support: IE <=9 only
|
|
||||||
// https://msdn.microsoft.com/en-us/library/hh801223(v=vs.85).aspx
|
|
||||||
QUnit.test( "VML with special event handlers (trac-7071)", function( assert ) {
|
|
||||||
assert.expect( 1 );
|
|
||||||
|
|
||||||
var ns = jQuery( "<xml:namespace ns='urn:schemas-microsoft-com:vml' prefix='v' />" ).appendTo( "head" );
|
|
||||||
|
|
||||||
jQuery( "<v:oval id='oval' style='width:100pt;height:75pt;' fillcolor='red'> </v:oval>" ).appendTo( "#form" );
|
|
||||||
jQuery( "#form" ).on( "keydown", function() {
|
|
||||||
assert.ok( true, "no error was thrown" );
|
|
||||||
} );
|
|
||||||
jQuery( "#oval" ).trigger( "click" ).trigger( "keydown" );
|
|
||||||
ns.remove();
|
|
||||||
} );
|
|
||||||
|
|
||||||
QUnit.test( "focusout/focusin support", function( assert ) {
|
QUnit.test( "focusout/focusin support", function( assert ) {
|
||||||
assert.expect( 6 );
|
assert.expect( 6 );
|
||||||
|
|
||||||
|
@ -511,18 +511,6 @@ QUnit.test( "Tag name processing respects the HTML Standard (gh-2005)", function
|
|||||||
}
|
}
|
||||||
|
|
||||||
function assertSpecialCharsSupport( method, characters ) {
|
function assertSpecialCharsSupport( method, characters ) {
|
||||||
// Support: Android 4.4 only
|
|
||||||
// Chromium < 35 incorrectly upper-cases µ; Android 4.4 uses such a version by default
|
|
||||||
// (and its WebView, being un-updatable, will use it for eternity) so we need to blacklist
|
|
||||||
// that one for the tests to pass.
|
|
||||||
if ( characters === "µ" && /chrome/i.test( navigator.userAgent ) &&
|
|
||||||
navigator.userAgent.match( /chrome\/(\d+)/i )[ 1 ] < 35 ) {
|
|
||||||
assert.ok( true, "This Chromium version upper-cases µ incorrectly; skip test" );
|
|
||||||
assert.ok( true, "This Chromium version upper-cases µ incorrectly; skip test" );
|
|
||||||
assert.ok( true, "This Chromium version upper-cases µ incorrectly; skip test" );
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var child,
|
var child,
|
||||||
codepoint = characters.charCodeAt( 0 ).toString( 16 ).toUpperCase(),
|
codepoint = characters.charCodeAt( 0 ).toString( 16 ).toUpperCase(),
|
||||||
description = characters.length === 1 ?
|
description = characters.length === 1 ?
|
||||||
@ -592,28 +580,7 @@ QUnit.test( "append(xml)", function( assert ) {
|
|||||||
var xmlDoc, xml1, xml2;
|
var xmlDoc, xml1, xml2;
|
||||||
|
|
||||||
function createXMLDoc() {
|
function createXMLDoc() {
|
||||||
|
|
||||||
// Initialize DOM based upon latest installed MSXML or Netscape
|
|
||||||
var elem, n, len,
|
|
||||||
aActiveX =
|
|
||||||
[ "MSXML6.DomDocument",
|
|
||||||
"MSXML3.DomDocument",
|
|
||||||
"MSXML2.DomDocument",
|
|
||||||
"MSXML.DomDocument",
|
|
||||||
"Microsoft.XmlDom" ];
|
|
||||||
|
|
||||||
if ( document.implementation && "createDocument" in document.implementation ) {
|
|
||||||
return document.implementation.createDocument( "", "", null );
|
return document.implementation.createDocument( "", "", null );
|
||||||
} else {
|
|
||||||
|
|
||||||
// IE
|
|
||||||
for ( n = 0, len = aActiveX.length; n < len; n++ ) {
|
|
||||||
try {
|
|
||||||
elem = new window.ActiveXObject( aActiveX[ n ] );
|
|
||||||
return elem;
|
|
||||||
} catch ( _ ) {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
xmlDoc = createXMLDoc();
|
xmlDoc = createXMLDoc();
|
||||||
@ -1825,15 +1792,10 @@ QUnit[
|
|||||||
}, 1000 );
|
}, 1000 );
|
||||||
} );
|
} );
|
||||||
|
|
||||||
QUnit[
|
QUnit.test( "html(script nomodule)", function( assert ) {
|
||||||
// Support: IE 9-11 only, Android 4.0-4.4 only, iOS 7-10 only
|
|
||||||
|
// Support: IE 9 - 11+
|
||||||
// `nomodule` scripts should be executed by legacy browsers only.
|
// `nomodule` scripts should be executed by legacy browsers only.
|
||||||
// iOS 10 supports `<script type="module">` but doesn't support the nomodule attribute
|
|
||||||
// so let's skip it here; sites supporting it must handle `nomodule` in a custom way anyway.
|
|
||||||
!/iphone os 10_/i.test( navigator.userAgent ) ?
|
|
||||||
"test" :
|
|
||||||
"skip"
|
|
||||||
]( "html(script nomodule)", function( assert ) {
|
|
||||||
assert.expect( QUnit.moduleTypeSupported ? 0 : 4 );
|
assert.expect( QUnit.moduleTypeSupported ? 0 : 4 );
|
||||||
var done = assert.async(),
|
var done = assert.async(),
|
||||||
$fixture = jQuery( "#qunit-fixture" );
|
$fixture = jQuery( "#qunit-fixture" );
|
||||||
@ -2676,14 +2638,18 @@ QUnit.test( "Make sure specific elements with content created correctly (#13232)
|
|||||||
|
|
||||||
jQuery.each( elems, function( name, value ) {
|
jQuery.each( elems, function( name, value ) {
|
||||||
var html = "<" + name + ">" + value + "</" + name + ">";
|
var html = "<" + name + ">" + value + "</" + name + ">";
|
||||||
assert.ok( jQuery.parseHTML( "<" + name + ">" + value + "</" + name + ">" )[ 0 ].nodeName.toLowerCase() === name, name + " is created correctly" );
|
assert.strictEqual(
|
||||||
|
jQuery.parseHTML( "<" + name + ">" + value + "</" + name + ">" )[ 0 ].nodeName.toLowerCase(),
|
||||||
|
name,
|
||||||
|
name + " is created correctly"
|
||||||
|
);
|
||||||
|
|
||||||
results.push( name );
|
results.push( name );
|
||||||
args.push( html );
|
args.push( html );
|
||||||
} );
|
} );
|
||||||
|
|
||||||
jQuery.fn.append.apply( jQuery( "<div/>" ), args ).children().each( function( i ) {
|
jQuery.fn.append.apply( jQuery( "<div/>" ), args ).children().each( function( i ) {
|
||||||
assert.ok( this.nodeName.toLowerCase() === results[ i ] );
|
assert.strictEqual( this.nodeName.toLowerCase(), results[ i ] );
|
||||||
} );
|
} );
|
||||||
} );
|
} );
|
||||||
|
|
||||||
@ -2827,6 +2793,7 @@ QUnit.test( "Make sure tags with single-character names are found (gh-4124)", fu
|
|||||||
|
|
||||||
QUnit.test( "Insert script with data-URI (gh-1887)", function( assert ) {
|
QUnit.test( "Insert script with data-URI (gh-1887)", function( assert ) {
|
||||||
assert.expect( 1 );
|
assert.expect( 1 );
|
||||||
|
|
||||||
Globals.register( "testFoo" );
|
Globals.register( "testFoo" );
|
||||||
Globals.register( "testSrcFoo" );
|
Globals.register( "testSrcFoo" );
|
||||||
|
|
||||||
@ -2885,13 +2852,10 @@ testIframe(
|
|||||||
} );
|
} );
|
||||||
},
|
},
|
||||||
|
|
||||||
// Support: Edge 18+, iOS 7-9 only, Android 4.0-4.4 only
|
// Support: Edge <=18+
|
||||||
// Edge doesn't support nonce in non-inline scripts.
|
// Edge doesn't support nonce in non-inline scripts.
|
||||||
// See https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/13246371/
|
// See https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/13246371/
|
||||||
// Old iOS & Android Browser versions support script-src but not nonce, making this test
|
QUnit[ /\bedge\//i.test( navigator.userAgent ) ? "skip" : "test" ]
|
||||||
// impossible to run. Browsers not supporting CSP at all are not a problem as they'll skip
|
|
||||||
// script-src restrictions completely.
|
|
||||||
QUnit[ /\bedge\/|iphone os [789]|android 4\./i.test( navigator.userAgent ) ? "skip" : "test" ]
|
|
||||||
);
|
);
|
||||||
|
|
||||||
testIframe(
|
testIframe(
|
||||||
@ -2908,13 +2872,10 @@ testIframe(
|
|||||||
} );
|
} );
|
||||||
},
|
},
|
||||||
|
|
||||||
// Support: Edge 18+, iOS 7-9 only, Android 4.0-4.4 only
|
// Support: Edge <=18+
|
||||||
// Edge doesn't support nonce in non-inline scripts.
|
// Edge doesn't support nonce in non-inline scripts.
|
||||||
// See https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/13246371/
|
// See https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/13246371/
|
||||||
// Old iOS & Android Browser versions support script-src but not nonce, making this test
|
QUnit[ /\bedge\//i.test( navigator.userAgent ) ? "skip" : "test" ]
|
||||||
// impossible to run. Browsers not supporting CSP at all are not a problem as they'll skip
|
|
||||||
// script-src restrictions completely.
|
|
||||||
QUnit[ /\bedge\/|iphone os [789]|android 4\./i.test( navigator.userAgent ) ? "skip" : "test" ]
|
|
||||||
);
|
);
|
||||||
|
|
||||||
testIframe(
|
testIframe(
|
||||||
@ -2931,11 +2892,8 @@ testIframe(
|
|||||||
} );
|
} );
|
||||||
},
|
},
|
||||||
|
|
||||||
// Support: Edge 18+, iOS 7-9 only, Android 4.0-4.4 only
|
// Support: Edge <=18+
|
||||||
// Edge doesn't support nonce in non-inline scripts.
|
// Edge doesn't support nonce in non-inline scripts.
|
||||||
// See https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/13246371/
|
// See https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/13246371/
|
||||||
// Old iOS & Android Browser versions support script-src but not nonce, making this test
|
QUnit[ /\bedge\//i.test( navigator.userAgent ) ? "skip" : "test" ]
|
||||||
// impossible to run. Browsers not supporting CSP at all are not a problem as they'll skip
|
|
||||||
// script-src restrictions completely.
|
|
||||||
QUnit[ /\bedge\/|iphone os [789]|android 4\./i.test( navigator.userAgent ) ? "skip" : "test" ]
|
|
||||||
);
|
);
|
||||||
|
@ -4,26 +4,20 @@ if ( !jQuery.fn.offset ) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var supportsFixedPosition, supportsScroll, alwaysScrollable,
|
var supportsScroll, alwaysScrollable,
|
||||||
forceScroll = supportjQuery( "<div/>" ).css( { width: 2000, height: 2000 } ),
|
forceScroll = supportjQuery( "<div/>" ).css( { width: 2000, height: 2000 } ),
|
||||||
checkSupport = function( assert ) {
|
checkSupport = function( assert ) {
|
||||||
|
|
||||||
// Only run once
|
// Only run once
|
||||||
checkSupport = false;
|
checkSupport = false;
|
||||||
|
|
||||||
var checkFixed = supportjQuery( "<div/>" )
|
|
||||||
.css( { position: "fixed", top: "20px" } )
|
|
||||||
.appendTo( "#qunit-fixture" );
|
|
||||||
supportsFixedPosition = checkFixed[ 0 ].offsetTop === 20;
|
|
||||||
checkFixed.remove();
|
|
||||||
|
|
||||||
// Append forceScroll to the body instead of #qunit-fixture because the latter is hidden
|
// Append forceScroll to the body instead of #qunit-fixture because the latter is hidden
|
||||||
forceScroll.appendTo( "body" );
|
forceScroll.appendTo( "body" );
|
||||||
window.scrollTo( 200, 200 );
|
window.scrollTo( 200, 200 );
|
||||||
supportsScroll = document.documentElement.scrollTop || document.body.scrollTop;
|
supportsScroll = document.documentElement.scrollTop || document.body.scrollTop;
|
||||||
forceScroll.detach();
|
forceScroll.detach();
|
||||||
|
|
||||||
// Support: iOS <=7
|
// Support: iOS <=7 - 12+
|
||||||
// Hijack the iframe test infrastructure to detect viewport scrollability
|
// Hijack the iframe test infrastructure to detect viewport scrollability
|
||||||
// for pages with position:fixed document element
|
// for pages with position:fixed document element
|
||||||
var done = assert.async();
|
var done = assert.async();
|
||||||
@ -400,22 +394,13 @@ testIframe( "fixed", "offset/fixed.html", function( assert, $, window ) {
|
|||||||
assert.ok( true, "Browser doesn't support scroll position." );
|
assert.ok( true, "Browser doesn't support scroll position." );
|
||||||
assert.ok( true, "Browser doesn't support scroll position." );
|
assert.ok( true, "Browser doesn't support scroll position." );
|
||||||
|
|
||||||
} else if ( window.supportsFixedPosition ) {
|
} else {
|
||||||
assert.equal( jQuery.isPlainObject( $( this.id ).offset() ), true, "jQuery('" + this.id + "').offset() is plain object" );
|
assert.equal( jQuery.isPlainObject( $( this.id ).offset() ), true, "jQuery('" + this.id + "').offset() is plain object" );
|
||||||
assert.equal( jQuery.isPlainObject( $( this.id ).position() ), true, "jQuery('" + this.id + "').position() is plain object" );
|
assert.equal( jQuery.isPlainObject( $( this.id ).position() ), true, "jQuery('" + this.id + "').position() is plain object" );
|
||||||
assert.equal( $( this.id ).offset().top, this.offsetTop, "jQuery('" + this.id + "').offset().top" );
|
assert.equal( $( this.id ).offset().top, this.offsetTop, "jQuery('" + this.id + "').offset().top" );
|
||||||
assert.equal( $( this.id ).position().top, this.positionTop, "jQuery('" + this.id + "').position().top" );
|
assert.equal( $( this.id ).position().top, this.positionTop, "jQuery('" + this.id + "').position().top" );
|
||||||
assert.equal( $( this.id ).offset().left, this.offsetLeft, "jQuery('" + this.id + "').offset().left" );
|
assert.equal( $( this.id ).offset().left, this.offsetLeft, "jQuery('" + this.id + "').offset().left" );
|
||||||
assert.equal( $( this.id ).position().left, this.positionLeft, "jQuery('" + this.id + "').position().left" );
|
assert.equal( $( this.id ).position().left, this.positionLeft, "jQuery('" + this.id + "').position().left" );
|
||||||
} else {
|
|
||||||
|
|
||||||
// need to have same number of assertions
|
|
||||||
assert.ok( true, "Fixed position is not supported" );
|
|
||||||
assert.ok( true, "Fixed position is not supported" );
|
|
||||||
assert.ok( true, "Fixed position is not supported" );
|
|
||||||
assert.ok( true, "Fixed position is not supported" );
|
|
||||||
assert.ok( true, "Fixed position is not supported" );
|
|
||||||
assert.ok( true, "Fixed position is not supported" );
|
|
||||||
}
|
}
|
||||||
} );
|
} );
|
||||||
|
|
||||||
@ -429,7 +414,6 @@ testIframe( "fixed", "offset/fixed.html", function( assert, $, window ) {
|
|||||||
];
|
];
|
||||||
|
|
||||||
jQuery.each( tests, function() {
|
jQuery.each( tests, function() {
|
||||||
if ( window.supportsFixedPosition ) {
|
|
||||||
$( this.id ).offset( { "top": this.top, "left": this.left } );
|
$( this.id ).offset( { "top": this.top, "left": this.left } );
|
||||||
assert.equal( $( this.id ).offset().top, this.top, "jQuery('" + this.id + "').offset({ top: " + this.top + " })" );
|
assert.equal( $( this.id ).offset().top, this.top, "jQuery('" + this.id + "').offset({ top: " + this.top + " })" );
|
||||||
assert.equal( $( this.id ).offset().left, this.left, "jQuery('" + this.id + "').offset({ left: " + this.left + " })" );
|
assert.equal( $( this.id ).offset().left, this.left, "jQuery('" + this.id + "').offset({ left: " + this.left + " })" );
|
||||||
@ -442,27 +426,13 @@ testIframe( "fixed", "offset/fixed.html", function( assert, $, window ) {
|
|||||||
} } );
|
} } );
|
||||||
assert.equal( $( this.id ).offset().top, this.top + 1, "jQuery('" + this.id + "').offset({ top: " + ( this.top + 1 ) + ", using: fn })" );
|
assert.equal( $( this.id ).offset().top, this.top + 1, "jQuery('" + this.id + "').offset({ top: " + ( this.top + 1 ) + ", using: fn })" );
|
||||||
assert.equal( $( this.id ).offset().left, this.left + 1, "jQuery('" + this.id + "').offset({ left: " + ( this.left + 1 ) + ", using: fn })" );
|
assert.equal( $( this.id ).offset().left, this.left + 1, "jQuery('" + this.id + "').offset({ left: " + ( this.left + 1 ) + ", using: fn })" );
|
||||||
} else {
|
|
||||||
|
|
||||||
// need to have same number of assertions
|
|
||||||
assert.ok( true, "Fixed position is not supported" );
|
|
||||||
assert.ok( true, "Fixed position is not supported" );
|
|
||||||
assert.ok( true, "Fixed position is not supported" );
|
|
||||||
assert.ok( true, "Fixed position is not supported" );
|
|
||||||
}
|
|
||||||
} );
|
} );
|
||||||
|
|
||||||
// Bug 8316
|
// Bug 8316
|
||||||
$noTopLeft = $( "#fixed-no-top-left" );
|
$noTopLeft = $( "#fixed-no-top-left" );
|
||||||
if ( window.supportsFixedPosition ) {
|
|
||||||
assert.equal( $noTopLeft.offset().top, 1007, "Check offset top for fixed element with no top set" );
|
assert.equal( $noTopLeft.offset().top, 1007, "Check offset top for fixed element with no top set" );
|
||||||
assert.equal( $noTopLeft.offset().left, 1007, "Check offset left for fixed element with no left set" );
|
assert.equal( $noTopLeft.offset().left, 1007, "Check offset left for fixed element with no left set" );
|
||||||
} else {
|
|
||||||
|
|
||||||
// need to have same number of assertions
|
|
||||||
assert.ok( true, "Fixed position is not supported" );
|
|
||||||
assert.ok( true, "Fixed position is not supported" );
|
|
||||||
}
|
|
||||||
} );
|
} );
|
||||||
|
|
||||||
testIframe( "table", "offset/table.html", function( assert, $ ) {
|
testIframe( "table", "offset/table.html", function( assert, $ ) {
|
||||||
@ -660,25 +630,6 @@ QUnit.test( "chaining", function( assert ) {
|
|||||||
}
|
}
|
||||||
} );
|
} );
|
||||||
|
|
||||||
// Support: IE<=10 only
|
|
||||||
// Fudge the tests to work around <html>.gBCR() erroneously including margins
|
|
||||||
if ( /MSIE (?:9|10)\./.test( navigator.userAgent ) ) {
|
|
||||||
expectations.documentElement.pos.top -= expectations.documentElement.marginTop -
|
|
||||||
scrollTop;
|
|
||||||
expectations.documentElement.offset.top -= expectations.documentElement.marginTop -
|
|
||||||
scrollTop;
|
|
||||||
expectations.documentElement.pos.left -= expectations.documentElement.marginLeft -
|
|
||||||
scrollLeft;
|
|
||||||
expectations.documentElement.offset.left -= expectations.documentElement.marginLeft -
|
|
||||||
scrollLeft;
|
|
||||||
if ( htmlPos !== "static" ) {
|
|
||||||
delete expectations.documentElement;
|
|
||||||
delete expectations.body;
|
|
||||||
delete expectations.relative;
|
|
||||||
delete expectations.absolute;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return expectations;
|
return expectations;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -803,10 +754,10 @@ QUnit.test( "fractions (see #7730 and #7885)", function( assert ) {
|
|||||||
|
|
||||||
result = div.offset();
|
result = div.offset();
|
||||||
|
|
||||||
// Support: Chrome <=45 - 46
|
// Support: Chrome <=45 - 73+
|
||||||
// In recent Chrome these values differ a little.
|
// In recent Chrome these values differ a little.
|
||||||
assert.ok( Math.abs( result.top - expected.top ) < 0.25, "Check top within 0.25 of expected" );
|
assert.ok( Math.abs( result.top - expected.top ) < 0.25, "Check top within 0.25 of expected" );
|
||||||
assert.equal( result.left, expected.left, "Check left" );
|
assert.ok( Math.abs( result.left - expected.left ) < 0.25, "Check left within 0.25 of expected" );
|
||||||
|
|
||||||
div.remove();
|
div.remove();
|
||||||
} );
|
} );
|
||||||
@ -816,13 +767,10 @@ QUnit.test( "iframe scrollTop/Left (see gh-1945)", function( assert ) {
|
|||||||
|
|
||||||
var ifDoc = jQuery( "#iframe" )[ 0 ].contentDocument;
|
var ifDoc = jQuery( "#iframe" )[ 0 ].contentDocument;
|
||||||
|
|
||||||
// Mobile Safari resize the iframe by its content meaning it's not possible to scroll
|
// Support: iOS <=8 - 12+
|
||||||
|
// Mobile Safari resizes the iframe by its content meaning it's not possible to scroll
|
||||||
// the iframe but only its parent element.
|
// the iframe but only its parent element.
|
||||||
// It seems (not confirmed) in android 4.0 it's not possible to scroll iframes from the code.
|
if ( /iphone os|ipad/i.test( navigator.userAgent ) ) {
|
||||||
if (
|
|
||||||
/iphone os|ipad/i.test( navigator.userAgent ) ||
|
|
||||||
/android 4\.0/i.test( navigator.userAgent )
|
|
||||||
) {
|
|
||||||
assert.equal( true, true, "Can't scroll iframes in this environment" );
|
assert.equal( true, true, "Can't scroll iframes in this environment" );
|
||||||
assert.equal( true, true, "Can't scroll iframes in this environment" );
|
assert.equal( true, true, "Can't scroll iframes in this environment" );
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@ if ( jQuery.css ) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// This test checks CSP only for browsers with "Content-Security-Policy" header support
|
// This test checks CSP only for browsers with "Content-Security-Policy" header support
|
||||||
// i.e. no old WebKit or old Firefox
|
// i.e. no IE
|
||||||
testIframe(
|
testIframe(
|
||||||
"Check CSP (https://developer.mozilla.org/en-US/docs/Security/CSP) restrictions",
|
"Check CSP (https://developer.mozilla.org/en-US/docs/Security/CSP) restrictions",
|
||||||
"mock.php?action=cspFrame",
|
"mock.php?action=cspFrame",
|
||||||
@ -59,244 +59,63 @@ testIframe(
|
|||||||
userAgent = window.navigator.userAgent,
|
userAgent = window.navigator.userAgent,
|
||||||
expectedMap = {
|
expectedMap = {
|
||||||
edge: {
|
edge: {
|
||||||
"ajax": true,
|
boxSizingReliable: true,
|
||||||
"boxSizingReliable": true,
|
clearCloneStyle: true,
|
||||||
"checkClone": true,
|
noCloneChecked: true,
|
||||||
"checkOn": true,
|
optSelected: true,
|
||||||
"clearCloneStyle": true,
|
radioValue: true
|
||||||
"cors": true,
|
|
||||||
"createHTMLDocument": true,
|
|
||||||
"noCloneChecked": true,
|
|
||||||
"optSelected": true,
|
|
||||||
"pixelBoxStyles": true,
|
|
||||||
"pixelPosition": true,
|
|
||||||
"radioValue": true,
|
|
||||||
"reliableMarginLeft": true,
|
|
||||||
"scrollboxSize": true
|
|
||||||
},
|
},
|
||||||
ie_10_11: {
|
ie_11: {
|
||||||
"ajax": true,
|
boxSizingReliable: false,
|
||||||
"boxSizingReliable": false,
|
clearCloneStyle: false,
|
||||||
"checkClone": true,
|
noCloneChecked: false,
|
||||||
"checkOn": true,
|
optSelected: false,
|
||||||
"clearCloneStyle": false,
|
radioValue: false
|
||||||
"cors": true,
|
|
||||||
"createHTMLDocument": true,
|
|
||||||
"noCloneChecked": false,
|
|
||||||
"optSelected": false,
|
|
||||||
"pixelBoxStyles": true,
|
|
||||||
"pixelPosition": true,
|
|
||||||
"radioValue": false,
|
|
||||||
"reliableMarginLeft": true,
|
|
||||||
"scrollboxSize": true
|
|
||||||
},
|
|
||||||
ie_9: {
|
|
||||||
"ajax": true,
|
|
||||||
"boxSizingReliable": false,
|
|
||||||
"checkClone": true,
|
|
||||||
"checkOn": true,
|
|
||||||
"clearCloneStyle": false,
|
|
||||||
"cors": false,
|
|
||||||
"createHTMLDocument": true,
|
|
||||||
"noCloneChecked": false,
|
|
||||||
"optSelected": false,
|
|
||||||
"pixelBoxStyles": true,
|
|
||||||
"pixelPosition": true,
|
|
||||||
"radioValue": false,
|
|
||||||
"reliableMarginLeft": true,
|
|
||||||
"scrollboxSize": false
|
|
||||||
},
|
},
|
||||||
chrome: {
|
chrome: {
|
||||||
"ajax": true,
|
boxSizingReliable: true,
|
||||||
"boxSizingReliable": true,
|
clearCloneStyle: true,
|
||||||
"checkClone": true,
|
noCloneChecked: true,
|
||||||
"checkOn": true,
|
optSelected: true,
|
||||||
"clearCloneStyle": true,
|
radioValue: true
|
||||||
"cors": true,
|
|
||||||
"createHTMLDocument": true,
|
|
||||||
"noCloneChecked": true,
|
|
||||||
"optSelected": true,
|
|
||||||
"pixelBoxStyles": true,
|
|
||||||
"pixelPosition": true,
|
|
||||||
"radioValue": true,
|
|
||||||
"reliableMarginLeft": true,
|
|
||||||
"scrollboxSize": true
|
|
||||||
},
|
},
|
||||||
safari: {
|
safari: {
|
||||||
"ajax": true,
|
boxSizingReliable: true,
|
||||||
"boxSizingReliable": true,
|
clearCloneStyle: true,
|
||||||
"checkClone": true,
|
noCloneChecked: true,
|
||||||
"checkOn": true,
|
optSelected: true,
|
||||||
"clearCloneStyle": true,
|
radioValue: true
|
||||||
"cors": true,
|
|
||||||
"createHTMLDocument": true,
|
|
||||||
"noCloneChecked": true,
|
|
||||||
"optSelected": true,
|
|
||||||
"pixelBoxStyles": true,
|
|
||||||
"pixelPosition": true,
|
|
||||||
"radioValue": true,
|
|
||||||
"reliableMarginLeft": true,
|
|
||||||
"scrollboxSize": true
|
|
||||||
},
|
|
||||||
safari_9_10: {
|
|
||||||
"ajax": true,
|
|
||||||
"boxSizingReliable": true,
|
|
||||||
"checkClone": true,
|
|
||||||
"checkOn": true,
|
|
||||||
"clearCloneStyle": true,
|
|
||||||
"cors": true,
|
|
||||||
"createHTMLDocument": true,
|
|
||||||
"noCloneChecked": true,
|
|
||||||
"optSelected": true,
|
|
||||||
"pixelBoxStyles": false,
|
|
||||||
"pixelPosition": false,
|
|
||||||
"radioValue": true,
|
|
||||||
"reliableMarginLeft": true,
|
|
||||||
"scrollboxSize": true
|
|
||||||
},
|
},
|
||||||
firefox: {
|
firefox: {
|
||||||
"ajax": true,
|
boxSizingReliable: true,
|
||||||
"boxSizingReliable": true,
|
clearCloneStyle: true,
|
||||||
"checkClone": true,
|
noCloneChecked: true,
|
||||||
"checkOn": true,
|
optSelected: true,
|
||||||
"clearCloneStyle": true,
|
radioValue: true
|
||||||
"cors": true,
|
|
||||||
"createHTMLDocument": true,
|
|
||||||
"noCloneChecked": true,
|
|
||||||
"optSelected": true,
|
|
||||||
"pixelBoxStyles": true,
|
|
||||||
"pixelPosition": true,
|
|
||||||
"radioValue": true,
|
|
||||||
"reliableMarginLeft": true,
|
|
||||||
"scrollboxSize": true
|
|
||||||
},
|
|
||||||
firefox_60: {
|
|
||||||
"ajax": true,
|
|
||||||
"boxSizingReliable": true,
|
|
||||||
"checkClone": true,
|
|
||||||
"checkOn": true,
|
|
||||||
"clearCloneStyle": true,
|
|
||||||
"cors": true,
|
|
||||||
"createHTMLDocument": true,
|
|
||||||
"noCloneChecked": true,
|
|
||||||
"optSelected": true,
|
|
||||||
"pixelBoxStyles": true,
|
|
||||||
"pixelPosition": true,
|
|
||||||
"radioValue": true,
|
|
||||||
"reliableMarginLeft": false,
|
|
||||||
"scrollboxSize": true
|
|
||||||
},
|
},
|
||||||
ios: {
|
ios: {
|
||||||
"ajax": true,
|
boxSizingReliable: true,
|
||||||
"boxSizingReliable": true,
|
clearCloneStyle: true,
|
||||||
"checkClone": true,
|
noCloneChecked: true,
|
||||||
"checkOn": true,
|
optSelected: true,
|
||||||
"clearCloneStyle": true,
|
radioValue: true
|
||||||
"cors": true,
|
|
||||||
"createHTMLDocument": true,
|
|
||||||
"noCloneChecked": true,
|
|
||||||
"optSelected": true,
|
|
||||||
"pixelBoxStyles": true,
|
|
||||||
"pixelPosition": true,
|
|
||||||
"radioValue": true,
|
|
||||||
"reliableMarginLeft": true,
|
|
||||||
"scrollboxSize": true
|
|
||||||
},
|
|
||||||
ios_9_10: {
|
|
||||||
"ajax": true,
|
|
||||||
"boxSizingReliable": true,
|
|
||||||
"checkClone": true,
|
|
||||||
"checkOn": true,
|
|
||||||
"clearCloneStyle": true,
|
|
||||||
"cors": true,
|
|
||||||
"createHTMLDocument": true,
|
|
||||||
"noCloneChecked": true,
|
|
||||||
"optSelected": true,
|
|
||||||
"pixelBoxStyles": false,
|
|
||||||
"pixelPosition": false,
|
|
||||||
"radioValue": true,
|
|
||||||
"reliableMarginLeft": true,
|
|
||||||
"scrollboxSize": true
|
|
||||||
},
|
|
||||||
ios_8: {
|
|
||||||
"ajax": true,
|
|
||||||
"boxSizingReliable": true,
|
|
||||||
"checkClone": true,
|
|
||||||
"checkOn": true,
|
|
||||||
"clearCloneStyle": true,
|
|
||||||
"cors": true,
|
|
||||||
"createHTMLDocument": false,
|
|
||||||
"noCloneChecked": true,
|
|
||||||
"optSelected": true,
|
|
||||||
"pixelBoxStyles": false,
|
|
||||||
"pixelPosition": false,
|
|
||||||
"radioValue": true,
|
|
||||||
"reliableMarginLeft": true,
|
|
||||||
"scrollboxSize": true
|
|
||||||
},
|
|
||||||
ios_7: {
|
|
||||||
"ajax": true,
|
|
||||||
"boxSizingReliable": true,
|
|
||||||
"checkClone": true,
|
|
||||||
"checkOn": true,
|
|
||||||
"clearCloneStyle": true,
|
|
||||||
"cors": true,
|
|
||||||
"createHTMLDocument": true,
|
|
||||||
"noCloneChecked": true,
|
|
||||||
"optSelected": true,
|
|
||||||
"pixelBoxStyles": false,
|
|
||||||
"pixelPosition": false,
|
|
||||||
"radioValue": true,
|
|
||||||
"reliableMarginLeft": true,
|
|
||||||
"scrollboxSize": true
|
|
||||||
},
|
|
||||||
android: {
|
|
||||||
"ajax": true,
|
|
||||||
"boxSizingReliable": true,
|
|
||||||
"checkClone": false,
|
|
||||||
"checkOn": false,
|
|
||||||
"clearCloneStyle": true,
|
|
||||||
"cors": true,
|
|
||||||
"createHTMLDocument": true,
|
|
||||||
"noCloneChecked": true,
|
|
||||||
"optSelected": true,
|
|
||||||
"pixelBoxStyles": false,
|
|
||||||
"pixelPosition": false,
|
|
||||||
"radioValue": true,
|
|
||||||
"reliableMarginLeft": false,
|
|
||||||
"scrollboxSize": true
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
if ( /edge\//i.test( userAgent ) ) {
|
if ( /edge\//i.test( userAgent ) ) {
|
||||||
expected = expectedMap.edge;
|
expected = expectedMap.edge;
|
||||||
} else if ( /(msie 10\.0|trident\/7\.0)/i.test( userAgent ) ) {
|
} else if ( document.documentMode ) {
|
||||||
expected = expectedMap.ie_10_11;
|
expected = expectedMap.ie_11;
|
||||||
} else if ( /msie 9\.0/i.test( userAgent ) ) {
|
|
||||||
expected = expectedMap.ie_9;
|
|
||||||
} else if ( /chrome/i.test( userAgent ) ) {
|
} else if ( /chrome/i.test( userAgent ) ) {
|
||||||
|
|
||||||
// Catches Chrome on Android as well (i.e. the default
|
// Catches Chrome on Android & Opera as well.
|
||||||
// Android browser on Android >= 4.4).
|
|
||||||
expected = expectedMap.chrome;
|
expected = expectedMap.chrome;
|
||||||
} else if ( /\b(?:11|12)\.\d(\.\d+)* safari/i.test( userAgent ) ) {
|
} else if ( /\b\d+(\.\d+)+ safari/i.test( userAgent ) ) {
|
||||||
expected = expectedMap.safari;
|
expected = expectedMap.safari;
|
||||||
} else if ( /\b(?:9|10)\.\d(\.\d+)* safari/i.test( userAgent ) ) {
|
|
||||||
expected = expectedMap.safari_9_10;
|
|
||||||
} else if ( /firefox\/(?:52|60)/i.test( userAgent ) ) {
|
|
||||||
expected = expectedMap.firefox_60;
|
|
||||||
} else if ( /firefox/i.test( userAgent ) ) {
|
} else if ( /firefox/i.test( userAgent ) ) {
|
||||||
expected = expectedMap.firefox;
|
expected = expectedMap.firefox;
|
||||||
} else if ( /(?:iphone|ipad);.*(?:iphone)? os (?:11|12)_/i.test( userAgent ) ) {
|
} else if ( /(?:iphone|ipad);.*(?:iphone)? os \d+_/i.test( userAgent ) ) {
|
||||||
expected = expectedMap.ios;
|
expected = expectedMap.ios;
|
||||||
} else if ( /iphone os (?:9|10)_/i.test( userAgent ) ) {
|
|
||||||
expected = expectedMap.ios_9_10;
|
|
||||||
} else if ( /iphone os 8_/i.test( userAgent ) ) {
|
|
||||||
expected = expectedMap.ios_8;
|
|
||||||
} else if ( /iphone os 7_/i.test( userAgent ) ) {
|
|
||||||
expected = expectedMap.ios_7;
|
|
||||||
} else if ( /android 4\.[0-3]/i.test( userAgent ) ) {
|
|
||||||
expected = expectedMap.android;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QUnit.test( "Verify that support tests resolve as expected per browser", function( assert ) {
|
QUnit.test( "Verify that support tests resolve as expected per browser", function( assert ) {
|
||||||
@ -315,13 +134,9 @@ testIframe(
|
|||||||
assert.expect( j );
|
assert.expect( j );
|
||||||
|
|
||||||
for ( i in expected ) {
|
for ( i in expected ) {
|
||||||
if ( jQuery.ajax || i !== "ajax" && i !== "cors" ) {
|
|
||||||
assert.equal( computedSupport[ i ], expected[ i ],
|
assert.equal( computedSupport[ i ], expected[ i ],
|
||||||
"jQuery.support['" + i + "']: " + computedSupport[ i ] +
|
"jQuery.support['" + i + "']: " + computedSupport[ i ] +
|
||||||
", expected['" + i + "']: " + expected[ i ] );
|
", expected['" + i + "']: " + expected[ i ] );
|
||||||
} else {
|
|
||||||
assert.ok( true, "no ajax; skipping jQuery.support['" + i + "']" );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} );
|
} );
|
||||||
|
|
||||||
@ -331,10 +146,7 @@ testIframe(
|
|||||||
var prop, browserKey, supportTestName,
|
var prop, browserKey, supportTestName,
|
||||||
i = 0,
|
i = 0,
|
||||||
supportProps = {},
|
supportProps = {},
|
||||||
failingSupportProps = {},
|
failingSupportProps = {};
|
||||||
whitelist = {
|
|
||||||
ajax: true
|
|
||||||
};
|
|
||||||
|
|
||||||
for ( prop in computedSupport ) {
|
for ( prop in computedSupport ) {
|
||||||
i++;
|
i++;
|
||||||
@ -342,8 +154,8 @@ testIframe(
|
|||||||
|
|
||||||
assert.expect( i );
|
assert.expect( i );
|
||||||
|
|
||||||
// Record all support props and the failing ones and ensure everyone
|
// Record all support props and the failing ones and ensure every test
|
||||||
// except a few on a whitelist are failing at least once.
|
// is failing at least once.
|
||||||
for ( browserKey in expectedMap ) {
|
for ( browserKey in expectedMap ) {
|
||||||
for ( supportTestName in expectedMap[ browserKey ] ) {
|
for ( supportTestName in expectedMap[ browserKey ] ) {
|
||||||
supportProps[ supportTestName ] = true;
|
supportProps[ supportTestName ] = true;
|
||||||
@ -354,8 +166,9 @@ testIframe(
|
|||||||
}
|
}
|
||||||
|
|
||||||
for ( supportTestName in supportProps ) {
|
for ( supportTestName in supportProps ) {
|
||||||
assert.ok( whitelist[ supportTestName ] || failingSupportProps[ supportTestName ],
|
assert.ok( failingSupportProps[ supportTestName ],
|
||||||
"jQuery.support['" + supportTestName + "'] always succeeds; remove it?" );
|
"jQuery.support['" + supportTestName +
|
||||||
|
"'] is expected to fail at least in one browser" );
|
||||||
}
|
}
|
||||||
} );
|
} );
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user