Commit 91e06e9a authored by Timmy Willison's avatar Timmy Willison

Build: update grunt-jscs-checker and pass with the new rules

Conflicts:
	build/tasks/build.js
	src/ajax/xhr.js
	src/attributes/classes.js
	src/attributes/prop.js
	src/attributes/val.js
	src/core/init.js
	src/core/ready.js
	src/css.js
	src/css/curCSS.js
	src/css/defaultDisplay.js
	src/data.js
	src/data/var/dataPriv.js
	src/data/var/dataUser.js
	src/dimensions.js
	src/effects.js
	src/event.js
	src/manipulation.js
	src/offset.js
	src/queue.js
	src/selector-native.js
	test/data/testrunner.js
parent 511eb154
...@@ -19,7 +19,7 @@ module.exports = function( grunt ) { ...@@ -19,7 +19,7 @@ module.exports = function( grunt ) {
grunt.initConfig({ grunt.initConfig({
pkg: grunt.file.readJSON( "package.json" ), pkg: grunt.file.readJSON( "package.json" ),
dst: readOptionalJSON( "dist/.destination.json" ), dst: readOptionalJSON( "dist/.destination.json" ),
compare_size: { "compare_size": {
files: [ "dist/jquery.js", "dist/jquery.min.js" ], files: [ "dist/jquery.js", "dist/jquery.min.js" ],
options: { options: {
compress: { compress: {
...@@ -92,13 +92,31 @@ module.exports = function( grunt ) { ...@@ -92,13 +92,31 @@ module.exports = function( grunt ) {
src: "src/**/*.js", src: "src/**/*.js",
gruntfile: "Gruntfile.js", gruntfile: "Gruntfile.js",
// Right know, check only test helpers // Right now, check only test helpers
test: [ "test/data/testrunner.js", "test/data/testinit.js" ], test: [ "test/data/testrunner.js" ],
release: "build/*.js", release: [ "build/*.js", "!build/release-notes.js" ],
tasks: "build/tasks/*.js" tasks: "build/tasks/*.js"
}, },
testswarm: { testswarm: {
tests: "ajax attributes callbacks core css data deferred dimensions effects event manipulation offset queue selector serialize support traversing".split( " " ) tests: [
"ajax",
"attributes",
"callbacks",
"core",
"css",
"data",
"deferred",
"dimensions",
"effects",
"event",
"manipulation",
"offset",
"queue",
"selector",
"serialize",
"support",
"traversing"
]
}, },
watch: { watch: {
files: [ "<%= jshint.all.src %>" ], files: [ "<%= jshint.all.src %>" ],
...@@ -115,13 +133,13 @@ module.exports = function( grunt ) { ...@@ -115,13 +133,13 @@ module.exports = function( grunt ) {
sourceMappingURL: "jquery.min.map", sourceMappingURL: "jquery.min.map",
report: "min", report: "min",
beautify: { beautify: {
ascii_only: true "ascii_only": true
}, },
banner: "/*! jQuery v<%= pkg.version %> | " + banner: "/*! jQuery v<%= pkg.version %> | " +
"(c) 2005, <%= grunt.template.today('yyyy') %> jQuery Foundation, Inc. | " + "(c) 2005, <%= grunt.template.today('yyyy') %> jQuery Foundation, Inc. | " +
"jquery.org/license */", "jquery.org/license */",
compress: { compress: {
hoist_funs: false, "hoist_funs": false,
loops: false, loops: false,
unused: false unused: false
} }
......
...@@ -16,7 +16,8 @@ http.request({ ...@@ -16,7 +16,8 @@ http.request({
host: "bugs.jquery.com", host: "bugs.jquery.com",
port: 80, port: 80,
method: "GET", method: "GET",
path: "/query?status=closed&resolution=fixed&max=400&component=!web&order=component&milestone=" + version path: "/query?status=closed&resolution=fixed&max=400&" +
"component=!web&order=component&milestone=" + version
}, function( res ) { }, function( res ) {
var data = []; var data = [];
......
...@@ -88,7 +88,9 @@ module.exports = function( Release ) { ...@@ -88,7 +88,9 @@ module.exports = function( Release ) {
var archiver = require( "archiver" )( "zip" ), var archiver = require( "archiver" )( "zip" ),
md5file = cdnFolder + "/" + cdn + "-md5.txt", md5file = cdnFolder + "/" + cdn + "-md5.txt",
output = fs.createWriteStream( cdnFolder + "/" + cdn + "-jquery-" + Release.newVersion + ".zip" ); output = fs.createWriteStream(
cdnFolder + "/" + cdn + "-jquery-" + Release.newVersion + ".zip"
);
output.on( "error", function( err ) { output.on( "error", function( err ) {
throw err; throw err;
......
/** /**
* Special concat/build task to handle various jQuery build requirements * Special concat/build task to handle various jQuery build requirements
* Concats AMD modules, removes their definitions, and includes/excludes specified modules * Concats AMD modules, removes their definitions,
* and includes/excludes specified modules
*/ */
module.exports = function( grunt ) { module.exports = function( grunt ) {
...@@ -35,7 +36,8 @@ module.exports = function( grunt ) { ...@@ -35,7 +36,8 @@ module.exports = function( grunt ) {
/** /**
* Strip all definitions generated by requirejs * Strip all definitions generated by requirejs
* Convert "var" modules to var declarations * Convert "var" modules to var declarations
* "var module" means the module only contains a return statement that should be converted to a var declaration * "var module" means the module only contains a return
* statement that should be converted to a var declaration
* This is indicated by including the file in any "var" folder * This is indicated by including the file in any "var" folder
* @param {String} name * @param {String} name
* @param {String} path * @param {String} path
...@@ -98,7 +100,8 @@ module.exports = function( grunt ) { ...@@ -98,7 +100,8 @@ module.exports = function( grunt ) {
grunt.registerMultiTask( grunt.registerMultiTask(
"build", "build",
"Concatenate source, remove sub AMD definitions, (include/exclude modules with +/- flags), embed date/version", "Concatenate source, remove sub AMD definitions, " +
"(include/exclude modules with +/- flags), embed date/version",
function() { function() {
var flag, index, var flag, index,
done = this.async(), done = this.async(),
...@@ -113,7 +116,8 @@ module.exports = function( grunt ) { ...@@ -113,7 +116,8 @@ module.exports = function( grunt ) {
/** /**
* Recursively calls the excluder to remove on all modules in the list * Recursively calls the excluder to remove on all modules in the list
* @param {Array} list * @param {Array} list
* @param {String} [prepend] Prepend this to the module name. Indicates we're walking a directory * @param {String} [prepend] Prepend this to the module name.
* Indicates we're walking a directory
*/ */
excludeList = function( list, prepend ) { excludeList = function( list, prepend ) {
if ( list ) { if ( list ) {
...@@ -121,7 +125,9 @@ module.exports = function( grunt ) { ...@@ -121,7 +125,9 @@ module.exports = function( grunt ) {
list.forEach(function( module ) { list.forEach(function( module ) {
// Exclude var modules as well // Exclude var modules as well
if ( module === "var" ) { if ( module === "var" ) {
excludeList( fs.readdirSync( srcFolder + prepend + module ), prepend + module ); excludeList(
fs.readdirSync( srcFolder + prepend + module ), prepend + module
);
return; return;
} }
if ( prepend ) { if ( prepend ) {
...@@ -143,7 +149,9 @@ module.exports = function( grunt ) { ...@@ -143,7 +149,9 @@ module.exports = function( grunt ) {
}, },
/** /**
* Adds the specified module to the excluded or included list, depending on the flag * Adds the specified module to the excluded or included list, depending on the flag
* @param {String} flag A module path relative to the src directory starting with + or - to indicate whether it should included or excluded * @param {String} flag A module path relative to
* the src directory starting with + or - to indicate
* whether it should included or excluded
*/ */
excluder = function( flag ) { excluder = function( flag ) {
var m = /^(\+|\-|)([\w\/-]+)$/.exec( flag ), var m = /^(\+|\-|)([\w\/-]+)$/.exec( flag ),
...@@ -162,7 +170,7 @@ module.exports = function( grunt ) { ...@@ -162,7 +170,7 @@ module.exports = function( grunt ) {
// It's fine if the directory is not there // It's fine if the directory is not there
try { try {
excludeList( fs.readdirSync( srcFolder + module ), module ); excludeList( fs.readdirSync( srcFolder + module ), module );
} catch( e ) { } catch ( e ) {
grunt.verbose.writeln( e ); grunt.verbose.writeln( e );
} }
} }
...@@ -192,8 +200,10 @@ module.exports = function( grunt ) { ...@@ -192,8 +200,10 @@ module.exports = function( grunt ) {
// * none (implicit exclude) // * none (implicit exclude)
// *:* all (implicit include) // *:* all (implicit include)
// *:*:-css all except css and dependents (explicit > implicit) // *:*:-css all except css and dependents (explicit > implicit)
// *:*:-css:+effects same (excludes effects because explicit include is trumped by explicit exclude of dependency) // *:*:-css:+effects same (excludes effects because explicit include is
// *:+effects none except effects and its dependencies (explicit include trumps implicit exclude of dependency) // trumped by explicit exclude of dependency)
// *:+effects none except effects and its dependencies
// (explicit include trumps implicit exclude of dependency)
delete flags[ "*" ]; delete flags[ "*" ];
for ( flag in flags ) { for ( flag in flags ) {
excluder( flag ); excluder( flag );
...@@ -239,7 +249,9 @@ module.exports = function( grunt ) { ...@@ -239,7 +249,9 @@ module.exports = function( grunt ) {
// Turn off opt-in if necessary // Turn off opt-in if necessary
if ( !optIn ) { if ( !optIn ) {
// Overwrite the default inclusions with the explicit ones provided // Overwrite the default inclusions with the explicit ones provided
config.rawText.jquery = "define([" + (included.length ? included.join(",") : "") + "]);"; config.rawText.jquery = "define([" +
(included.length ? included.join(",") : "") +
"]);";
} }
// Trace dependencies and concatenate files // Trace dependencies and concatenate files
......
...@@ -49,7 +49,7 @@ var ...@@ -49,7 +49,7 @@ var
// a field from window.location if document.domain has been set // a field from window.location if document.domain has been set
try { try {
ajaxLocation = location.href; ajaxLocation = location.href;
} catch( e ) { } catch ( e ) {
// Use the href attribute of an A element // Use the href attribute of an A element
// since IE will modify it given document.location // since IE will modify it given document.location
ajaxLocation = document.createElement( "a" ); ajaxLocation = document.createElement( "a" );
...@@ -103,7 +103,9 @@ function inspectPrefiltersOrTransports( structure, options, originalOptions, jqX ...@@ -103,7 +103,9 @@ function inspectPrefiltersOrTransports( structure, options, originalOptions, jqX
inspected[ dataType ] = true; inspected[ dataType ] = true;
jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) { jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) {
var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR ); var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR );
if ( typeof dataTypeOrTransport === "string" && !seekingTransport && !inspected[ dataTypeOrTransport ] ) { if ( typeof dataTypeOrTransport === "string" &&
!seekingTransport && !inspected[ dataTypeOrTransport ] ) {
options.dataTypes.unshift( dataTypeOrTransport ); options.dataTypes.unshift( dataTypeOrTransport );
inspect( dataTypeOrTransport ); inspect( dataTypeOrTransport );
return false; return false;
...@@ -275,7 +277,10 @@ function ajaxConvert( s, response, jqXHR, isSuccess ) { ...@@ -275,7 +277,10 @@ function ajaxConvert( s, response, jqXHR, isSuccess ) {
try { try {
response = conv( response ); response = conv( response );
} catch ( e ) { } catch ( e ) {
return { state: "parsererror", error: conv ? e : "No conversion from " + prev + " to " + current }; return {
state: "parsererror",
error: conv ? e : "No conversion from " + prev + " to " + current
};
} }
} }
} }
...@@ -412,9 +417,10 @@ jQuery.extend({ ...@@ -412,9 +417,10 @@ jQuery.extend({
// Callbacks context // Callbacks context
callbackContext = s.context || s, callbackContext = s.context || s,
// Context for global events is callbackContext if it is a DOM node or jQuery collection // Context for global events is callbackContext if it is a DOM node or jQuery collection
globalEventContext = s.context && ( callbackContext.nodeType || callbackContext.jquery ) ? globalEventContext = s.context &&
jQuery( callbackContext ) : ( callbackContext.nodeType || callbackContext.jquery ) ?
jQuery.event, jQuery( callbackContext ) :
jQuery.event,
// Deferreds // Deferreds
deferred = jQuery.Deferred(), deferred = jQuery.Deferred(),
completeDeferred = jQuery.Callbacks("once memory"), completeDeferred = jQuery.Callbacks("once memory"),
...@@ -506,7 +512,9 @@ jQuery.extend({ ...@@ -506,7 +512,9 @@ jQuery.extend({
// Add protocol if not provided (#5866: IE7 issue with protocol-less urls) // Add protocol if not provided (#5866: IE7 issue with protocol-less urls)
// Handle falsy url in the settings object (#10093: consistency with old signature) // Handle falsy url in the settings object (#10093: consistency with old signature)
// We also use the url parameter if available // We also use the url parameter if available
s.url = ( ( url || s.url || ajaxLocation ) + "" ).replace( rhash, "" ).replace( rprotocol, ajaxLocParts[ 1 ] + "//" ); s.url = ( ( url || s.url || ajaxLocation ) + "" )
.replace( rhash, "" )
.replace( rprotocol, ajaxLocParts[ 1 ] + "//" );
// Alias method option to type as per ticket #12004 // Alias method option to type as per ticket #12004
s.type = options.method || options.type || s.method || s.type; s.type = options.method || options.type || s.method || s.type;
...@@ -597,7 +605,8 @@ jQuery.extend({ ...@@ -597,7 +605,8 @@ jQuery.extend({
jqXHR.setRequestHeader( jqXHR.setRequestHeader(
"Accept", "Accept",
s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[0] ] ? s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[0] ] ?
s.accepts[ s.dataTypes[0] ] + ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) : s.accepts[ s.dataTypes[0] ] +
( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
s.accepts[ "*" ] s.accepts[ "*" ]
); );
...@@ -607,7 +616,9 @@ jQuery.extend({ ...@@ -607,7 +616,9 @@ jQuery.extend({
} }
// Allow custom headers/mimetypes and early abort // Allow custom headers/mimetypes and early abort
if ( s.beforeSend && ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || state === 2 ) ) { if ( s.beforeSend &&
( s.beforeSend.call( callbackContext, jqXHR, s ) === false || state === 2 ) ) {
// Abort if not done already and return // Abort if not done already and return
return jqXHR.abort(); return jqXHR.abort();
} }
......
...@@ -24,7 +24,9 @@ jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) { ...@@ -24,7 +24,9 @@ jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
var callbackName, overwritten, responseContainer, var callbackName, overwritten, responseContainer,
jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ? jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ?
"url" : "url" :
typeof s.data === "string" && !( s.contentType || "" ).indexOf("application/x-www-form-urlencoded") && rjsonp.test( s.data ) && "data" typeof s.data === "string" &&
!( s.contentType || "" ).indexOf("application/x-www-form-urlencoded") &&
rjsonp.test( s.data ) && "data"
); );
// Handle iff the expected data type is "jsonp" or we have a parameter to set // Handle iff the expected data type is "jsonp" or we have a parameter to set
......
...@@ -17,7 +17,7 @@ jQuery.parseXML = function( data ) { ...@@ -17,7 +17,7 @@ jQuery.parseXML = function( data ) {
xml.async = "false"; xml.async = "false";
xml.loadXML( data ); xml.loadXML( data );
} }
} catch( e ) { } catch ( e ) {
xml = undefined; xml = undefined;
} }
if ( !xml || !xml.documentElement || xml.getElementsByTagName( "parsererror" ).length ) { if ( !xml || !xml.documentElement || xml.getElementsByTagName( "parsererror" ).length ) {
......
...@@ -6,7 +6,8 @@ define([ ...@@ -6,7 +6,8 @@ define([
// Install script dataType // Install script dataType
jQuery.ajaxSetup({ jQuery.ajaxSetup({
accepts: { accepts: {
script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript" script: "text/javascript, application/javascript, " +
"application/ecmascript, application/x-ecmascript"
}, },
contents: { contents: {
script: /(?:java|ecma)script/ script: /(?:java|ecma)script/
......
...@@ -60,7 +60,13 @@ if ( xhrSupported ) { ...@@ -60,7 +60,13 @@ if ( xhrSupported ) {
id = ++xhrId; id = ++xhrId;
// Open the socket // Open the socket
xhr.open( options.type, options.url, options.async, options.username, options.password ); xhr.open(
options.type,
options.url,
options.async,
options.username,
options.password
);
// Apply custom fields if provided // Apply custom fields if provided
if ( options.xhrFields ) { if ( options.xhrFields ) {
...@@ -132,7 +138,7 @@ if ( xhrSupported ) { ...@@ -132,7 +138,7 @@ if ( xhrSupported ) {
// statusText for faulty cross-domain requests // statusText for faulty cross-domain requests
try { try {
statusText = xhr.statusText; statusText = xhr.statusText;
} catch( e ) { } catch ( e ) {
// We normalize with Webkit giving an empty statusText // We normalize with Webkit giving an empty statusText
statusText = ""; statusText = "";
} }
...@@ -184,13 +190,13 @@ if ( xhrSupported ) { ...@@ -184,13 +190,13 @@ if ( xhrSupported ) {
function createStandardXHR() { function createStandardXHR() {
try { try {
return new window.XMLHttpRequest(); return new window.XMLHttpRequest();
} catch( e ) {} } catch ( e ) {}
} }
function createActiveXHR() { function createActiveXHR() {
try { try {
return new window.ActiveXObject( "Microsoft.XMLHTTP" ); return new window.ActiveXObject( "Microsoft.XMLHTTP" );
} catch( e ) {} } catch ( e ) {}
} }
}); });
...@@ -54,7 +54,9 @@ jQuery.extend({ ...@@ -54,7 +54,9 @@ jQuery.extend({
if ( value === null ) { if ( value === null ) {
jQuery.removeAttr( elem, name ); jQuery.removeAttr( elem, name );
} else if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) { } else if ( hooks && "set" in hooks &&
(ret = hooks.set( elem, value, name )) !== undefined ) {
return ret; return ret;
} else { } else {
......
...@@ -103,7 +103,9 @@ jQuery.fn.extend({ ...@@ -103,7 +103,9 @@ jQuery.fn.extend({
if ( jQuery.isFunction( value ) ) { if ( jQuery.isFunction( value ) ) {
return this.each(function( i ) { return this.each(function( i ) {
jQuery( this ).toggleClass( value.call(this, i, this.className, stateVal), stateVal ); jQuery( this ).toggleClass(
value.call(this, i, this.className, stateVal), stateVal
);
}); });
} }
...@@ -135,7 +137,9 @@ jQuery.fn.extend({ ...@@ -135,7 +137,9 @@ jQuery.fn.extend({
// then remove the whole classname (if there was one, the above saved it). // then remove the whole classname (if there was one, the above saved it).
// Otherwise bring back whatever was previously saved (if anything), // Otherwise bring back whatever was previously saved (if anything),
// falling back to the empty string if nothing was stored. // falling back to the empty string if nothing was stored.
this.className = this.className || value === false ? "" : jQuery._data( this, "__className__" ) || ""; this.className = this.className || value === false ?
"" :
jQuery._data( this, "__className__" ) || "";
} }
}); });
}, },
...@@ -145,7 +149,9 @@ jQuery.fn.extend({ ...@@ -145,7 +149,9 @@ jQuery.fn.extend({
i = 0, i = 0,
l = this.length; l = this.length;
for ( ; i < l; i++ ) { for ( ; i < l; i++ ) {
if ( this[i].nodeType === 1 && (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) >= 0 ) { if ( this[i].nodeType === 1 &&
(" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) >= 0 ) {
return true; return true;
} }
} }
......
...@@ -19,7 +19,7 @@ jQuery.fn.extend({ ...@@ -19,7 +19,7 @@ jQuery.fn.extend({
try { try {
this[ name ] = undefined; this[ name ] = undefined;
delete this[ name ]; delete this[ name ];
} catch( e ) {} } catch ( e ) {}
}); });
} }
}); });
...@@ -48,9 +48,10 @@ jQuery.extend({ ...@@ -48,9 +48,10 @@ jQuery.extend({
} }
if ( value !== undefined ) { if ( value !== undefined ) {
return hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ? return hooks && "set" in hooks &&
ret : (ret = hooks.set( elem, value, name )) !== undefined ?
( elem[ name ] = value ); ret :
( elem[ name ] = value );
} else { } else {
return hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ? return hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ?
...@@ -62,16 +63,18 @@ jQuery.extend({ ...@@ -62,16 +63,18 @@ jQuery.extend({
propHooks: { propHooks: {
tabIndex: { tabIndex: {
get: function( elem ) { get: function( elem ) {
// elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set // elem.tabIndex doesn't always return the
// correct value when it hasn't been explicitly set
// http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/ // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
// Use proper attribute retrieval(#12072) // Use proper attribute retrieval(#12072)
var tabindex = jQuery.find.attr( elem, "tabindex" ); var tabindex = jQuery.find.attr( elem, "tabindex" );
return tabindex ? return tabindex ?
parseInt( tabindex, 10 ) : parseInt( tabindex, 10 ) :
rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ? rfocusable.test( elem.nodeName ) ||
0 : rclickable.test( elem.nodeName ) && elem.href ?
-1; 0 :
-1;
} }
} }
} }
......
...@@ -19,7 +19,8 @@ define([ ...@@ -19,7 +19,8 @@ define([
a.style.cssText = "top:1px"; a.style.cssText = "top:1px";
// Test setAttribute on camelCase class. If it works, we need attrFixes when doing get/setAttribute (ie6/7) // Test setAttribute on camelCase class.
// If it works, we need attrFixes when doing get/setAttribute (ie6/7)
support.getSetAttribute = div.className !== "t"; support.getSetAttribute = div.className !== "t";
// Get the style information from getAttribute // Get the style information from getAttribute
......
...@@ -13,7 +13,8 @@ jQuery.fn.extend({ ...@@ -13,7 +13,8 @@ jQuery.fn.extend({
if ( !arguments.length ) { if ( !arguments.length ) {
if ( elem ) { if ( elem ) {
hooks = jQuery.valHooks[ elem.type ] || jQuery.valHooks[ elem.nodeName.toLowerCase() ]; hooks = jQuery.valHooks[ elem.type ] ||
jQuery.valHooks[ elem.nodeName.toLowerCase() ];
if ( hooks && "get" in hooks && (ret = hooks.get( elem, "value" )) !== undefined ) { if ( hooks && "get" in hooks && (ret = hooks.get( elem, "value" )) !== undefined ) {
return ret; return ret;
...@@ -98,8 +99,11 @@ jQuery.extend({ ...@@ -98,8 +99,11 @@ jQuery.extend({
// oldIE doesn't update selected after form reset (#2551) // oldIE doesn't update selected after form reset (#2551)
if ( ( option.selected || i === index ) && 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
( support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null ) && ( support.optDisabled ?
( !option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" ) ) ) { !option.disabled :
option.getAttribute("disabled") === null ) &&
( !option.parentNode.disabled ||
!jQuery.nodeName( option.parentNode, "optgroup" ) ) ) {
// Get the specific value for the option // Get the specific value for the option
value = jQuery( option ).val(); value = jQuery( option ).val();
......
...@@ -70,7 +70,9 @@ jQuery.Callbacks = function( options ) { ...@@ -70,7 +70,9 @@ jQuery.Callbacks = function( options ) {
firingLength = list.length; firingLength = list.length;
firing = true; firing = true;
for ( ; list && firingIndex < firingLength; firingIndex++ ) { for ( ; list && firingIndex < firingLength; firingIndex++ ) {
if ( list[ firingIndex ].apply( data[ 0 ], data[ 1 ] ) === false && options.stopOnFalse ) { if ( list[ firingIndex ].apply( data[ 0 ], data[ 1 ] ) === false &&
options.stopOnFalse ) {
memory = false; // To prevent further calls using add memory = false; // To prevent further calls using add
break; break;
} }
......
...@@ -159,7 +159,9 @@ jQuery.extend = jQuery.fn.extend = function() { ...@@ -159,7 +159,9 @@ jQuery.extend = jQuery.fn.extend = function() {
} }
// Recurse if we're merging plain objects or arrays // Recurse if we're merging plain objects or arrays
if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) { if ( deep && copy && ( jQuery.isPlainObject(copy) ||
(copyIsArray = jQuery.isArray(copy)) ) ) {
if ( copyIsArray ) { if ( copyIsArray ) {
copyIsArray = false; copyIsArray = false;
clone = src && jQuery.isArray(src) ? src : []; clone = src && jQuery.isArray(src) ? src : [];
...@@ -512,7 +514,8 @@ jQuery.extend({ ...@@ -512,7 +514,8 @@ jQuery.extend({
}); });
// Populate the class2type map // Populate the class2type map
jQuery.each("Boolean Number String Function Array Date RegExp Object Error".split(" "), function(i, name) { jQuery.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),
function(i, name) {
class2type[ "[object " + name + "]" ] = name.toLowerCase(); class2type[ "[object " + name + "]" ] = name.toLowerCase();
}); });
......
...@@ -26,7 +26,10 @@ var rootjQuery, ...@@ -26,7 +26,10 @@ var rootjQuery,
// Handle HTML strings // Handle HTML strings
if ( typeof selector === "string" ) { if ( typeof selector === "string" ) {
if ( selector.charAt(0) === "<" && selector.charAt( selector.length - 1 ) === ">" && selector.length >= 3 ) { if ( selector.charAt(0) === "<" &&
selector.charAt( selector.length - 1 ) === ">" &&
selector.length >= 3 ) {
// Assume that strings that start and end with <> are HTML and skip the regex check // Assume that strings that start and end with <> are HTML and skip the regex check
match = [ null, selector, null ]; match = [ null, selector, null ];
......
...@@ -5,7 +5,8 @@ define([ ...@@ -5,7 +5,8 @@ define([
], function( jQuery, rsingleTag ) { ], function( jQuery, rsingleTag ) {
// data: string of html // data: string of html
// context (optional): If specified, the fragment will be created in this context, defaults to document // context (optional): If specified, the fragment will be created in this context,
// defaults to document
// keepScripts (optional): If true, will include scripts passed in the html string // keepScripts (optional): If true, will include scripts passed in the html string
jQuery.parseHTML = function( data, context, keepScripts ) { jQuery.parseHTML = function( data, context, keepScripts ) {
if ( !data || typeof data !== "string" ) { if ( !data || typeof data !== "string" ) {
......
...@@ -82,7 +82,10 @@ function detach() { ...@@ -82,7 +82,10 @@ function detach() {
*/ */
function completed() { function completed() {
// readyState === "complete" is good enough for us to call the dom ready in oldIE // readyState === "complete" is good enough for us to call the dom ready in oldIE
if ( document.addEventListener || event.type === "load" || document.readyState === "complete" ) { if ( document.addEventListener ||
event.type === "load" ||
document.readyState === "complete" ) {
detach(); detach();
jQuery.ready(); jQuery.ready();
} }
...@@ -93,9 +96,12 @@ jQuery.ready.promise = function( obj ) { ...@@ -93,9 +96,12 @@ jQuery.ready.promise = function( obj ) {
readyList = jQuery.Deferred(); readyList = jQuery.Deferred();
// Catch cases where $(document).ready() is called after the browser event has already occurred. // Catch cases where $(document).ready() is called
// we once tried to use readyState "interactive" here, but it caused issues like the one // after the browser event has already occurred.
// discovered by ChrisS here: http://bugs.jquery.com/ticket/12282#comment:15 // we once tried to use readyState "interactive" here,
// but it caused issues like the one
// discovered by ChrisS here:
// http://bugs.jquery.com/ticket/12282#comment:15
if ( document.readyState === "complete" ) { if ( document.readyState === "complete" ) {
// Handle it asynchronously to allow scripts the opportunity to delay ready // Handle it asynchronously to allow scripts the opportunity to delay ready
setTimeout( jQuery.ready ); setTimeout( jQuery.ready );
...@@ -122,7 +128,7 @@ jQuery.ready.promise = function( obj ) { ...@@ -122,7 +128,7 @@ jQuery.ready.promise = function( obj ) {
try { try {
top = window.frameElement == null && document.documentElement; top = window.frameElement == null && document.documentElement;
} catch(e) {} } catch ( e ) {}
if ( top && top.doScroll ) { if ( top && top.doScroll ) {
(function doScrollCheck() { (function doScrollCheck() {
...@@ -132,7 +138,7 @@ jQuery.ready.promise = function( obj ) { ...@@ -132,7 +138,7 @@ jQuery.ready.promise = function( obj ) {
// Use the trick by Diego Perini // Use the trick by Diego Perini
// http://javascript.nwbox.com/IEContentLoaded/ // http://javascript.nwbox.com/IEContentLoaded/
top.doScroll("left"); top.doScroll("left");
} catch(e) { } catch ( e ) {
return setTimeout( doScrollCheck, 50 ); return setTimeout( doScrollCheck, 50 );
} }
......
...@@ -24,8 +24,10 @@ var ...@@ -24,8 +24,10 @@ var
ralpha = /alpha\([^)]*\)/i, ralpha = /alpha\([^)]*\)/i,
ropacity = /opacity\s*=\s*([^)]*)/, ropacity = /opacity\s*=\s*([^)]*)/,
// swappable if display is none or starts with table except "table", "table-cell", or "table-caption" // swappable if display is none or starts with table except
// see here for display values: https://developer.mozilla.org/en-US/docs/CSS/display // "table", "table-cell", or "table-caption"
// see here for display values:
// https://developer.mozilla.org/en-US/docs/CSS/display
rdisplayswap = /^(none|table(?!-c[ea]).+)/, rdisplayswap = /^(none|table(?!-c[ea]).+)/,
rnumsplit = new RegExp( "^(" + pnum + ")(.*)$", "i" ), rnumsplit = new RegExp( "^(" + pnum + ")(.*)$", "i" ),
rrelNum = new RegExp( "^([+-])=(" + pnum + ")", "i" ), rrelNum = new RegExp( "^([+-])=(" + pnum + ")", "i" ),
...@@ -95,7 +97,11 @@ function showHide( elements, show ) { ...@@ -95,7 +97,11 @@ function showHide( elements, show ) {
hidden = isHidden( elem ); hidden = isHidden( elem );
if ( display && display !== "none" || !hidden ) { if ( display && display !== "none" || !hidden ) {
jQuery._data( elem, "olddisplay", hidden ? display : jQuery.css( elem, "display" ) ); jQuery._data(
elem,
"olddisplay",
hidden ? display : jQuery.css( elem, "display" )
);
} }
} }
} }
...@@ -168,7 +174,8 @@ function getWidthOrHeight( elem, name, extra ) { ...@@ -168,7 +174,8 @@ function getWidthOrHeight( elem, name, extra ) {
var valueIsBorderBox = true, var valueIsBorderBox = true,
val = name === "width" ? elem.offsetWidth : elem.offsetHeight, val = name === "width" ? elem.offsetWidth : elem.offsetHeight,
styles = getStyles( elem ), styles = getStyles( elem ),
isBorderBox = support.boxSizing && jQuery.css( elem, "boxSizing", false, styles ) === "border-box"; isBorderBox = support.boxSizing &&
jQuery.css( elem, "boxSizing", false, styles ) === "border-box";
// some non-html elements return undefined for offsetWidth, so check for null/undefined // some non-html elements return undefined for offsetWidth, so check for null/undefined
// svg - https://bugzilla.mozilla.org/show_bug.cgi?id=649285 // svg - https://bugzilla.mozilla.org/show_bug.cgi?id=649285
...@@ -187,7 +194,8 @@ function getWidthOrHeight( elem, name, extra ) { ...@@ -187,7 +194,8 @@ function getWidthOrHeight( elem, name, extra ) {
// we need the check for style in case a browser which returns unreliable values // we need the check for style in case a browser which returns unreliable values
// for getComputedStyle silently falls back to the reliable elem.style // for getComputedStyle silently falls back to the reliable elem.style
valueIsBorderBox = isBorderBox && ( support.boxSizingReliable() || val === elem.style[ name ] ); valueIsBorderBox = isBorderBox &&
( support.boxSizingReliable() || val === elem.style[ name ] );
// Normalize "", auto, and prepare for extra // Normalize "", auto, and prepare for extra
val = parseFloat( val ) || 0; val = parseFloat( val ) || 0;
...@@ -255,7 +263,8 @@ jQuery.extend({ ...@@ -255,7 +263,8 @@ jQuery.extend({
origName = jQuery.camelCase( name ), origName = jQuery.camelCase( name ),
style = elem.style; style = elem.style;
name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( style, origName ) ); name = jQuery.cssProps[ origName ] ||
( jQuery.cssProps[ origName ] = vendorPropName( style, origName ) );
// gets hook for the prefixed version // gets hook for the prefixed version
// followed by the unprefixed version // followed by the unprefixed version
...@@ -283,24 +292,28 @@ jQuery.extend({ ...@@ -283,24 +292,28 @@ jQuery.extend({
} }
// Fixes #8908, it can be done more correctly by specifing setters in cssHooks, // Fixes #8908, it can be done more correctly by specifing setters in cssHooks,
// but it would mean to define eight (for every problematic property) identical functions // but it would mean to define eight
// (for every problematic property) identical functions
if ( !support.clearCloneStyle && value === "" && name.indexOf("background") === 0 ) { if ( !support.clearCloneStyle && value === "" && name.indexOf("background") === 0 ) {
style[ name ] = "inherit"; style[ name ] = "inherit";
} }
// If a hook was provided, use that value, otherwise just set the specified value // If a hook was provided, use that value, otherwise just set the specified value
if ( !hooks || !("set" in hooks) || (value = hooks.set( elem, value, extra )) !== undefined ) { if ( !hooks || !("set" in hooks) ||
(value = hooks.set( elem, value, extra )) !== undefined ) {
// Support: IE // Support: IE
// Swallow errors from 'invalid' CSS values (#5509) // Swallow errors from 'invalid' CSS values (#5509)
try { try {
style[ name ] = value; style[ name ] = value;
} catch(e) {} } catch (e) {}
} }
} else { } else {
// If a hook was provided get the non-computed value from there // If a hook was provided get the non-computed value from there
if ( hooks && "get" in hooks && (ret = hooks.get( elem, false, extra )) !== undefined ) { if ( hooks && "get" in hooks &&
(ret = hooks.get( elem, false, extra )) !== undefined ) {
return ret; return ret;
} }
...@@ -314,7 +327,8 @@ jQuery.extend({ ...@@ -314,7 +327,8 @@ jQuery.extend({
origName = jQuery.camelCase( name ); origName = jQuery.camelCase( name );
// Make sure that we're working with the right name // Make sure that we're working with the right name
name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( elem.style, origName ) ); name = jQuery.cssProps[ origName ] ||
( jQuery.cssProps[ origName ] = vendorPropName( elem.style, origName ) );
// gets hook for the prefixed version // gets hook for the prefixed version
// followed by the unprefixed version // followed by the unprefixed version
...@@ -350,11 +364,12 @@ jQuery.each([ "height", "width" ], function( i, name ) { ...@@ -350,11 +364,12 @@ jQuery.each([ "height", "width" ], function( i, name ) {
if ( computed ) { if ( computed ) {
// certain elements can have dimension info if we invisibly show them // certain elements can have dimension info if we invisibly show them
// however, it must have a current display style that would benefit from this // however, it must have a current display style that would benefit from this
return rdisplayswap.test( jQuery.css( elem, "display" ) ) && elem.offsetWidth === 0 ? return rdisplayswap.test( jQuery.css( elem, "display" ) ) &&
jQuery.swap( elem, cssShow, function() { elem.offsetWidth === 0 ?
return getWidthOrHeight( elem, name, extra ); jQuery.swap( elem, cssShow, function() {
}) : return getWidthOrHeight( elem, name, extra );
getWidthOrHeight( elem, name, extra ); }) :
getWidthOrHeight( elem, name, extra );
} }
}, },
...@@ -365,7 +380,8 @@ jQuery.each([ "height", "width" ], function( i, name ) { ...@@ -365,7 +380,8 @@ jQuery.each([ "height", "width" ], function( i, name ) {
elem, elem,
name, name,
extra, extra,
support.boxSizing && jQuery.css( elem, "boxSizing", false, styles ) === "border-box", support.boxSizing &&
jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
styles styles
) : 0 ) : 0
); );
...@@ -377,9 +393,11 @@ if ( !support.opacity ) { ...@@ -377,9 +393,11 @@ if ( !support.opacity ) {
jQuery.cssHooks.opacity = { jQuery.cssHooks.opacity = {
get: function( elem, computed ) { get: function( elem, computed ) {
// IE uses filters for opacity // IE uses filters for opacity
return ropacity.test( (computed && elem.currentStyle ? elem.currentStyle.filter : elem.style.filter) || "" ) ? return ropacity.test( (computed && elem.currentStyle ?
( 0.01 * parseFloat( RegExp.$1 ) ) + "" : elem.currentStyle.filter :
computed ? "1" : ""; elem.style.filter) || "" ) ?
( 0.01 * parseFloat( RegExp.$1 ) ) + "" :
computed ? "1" : "";
}, },
set: function( elem, value ) { set: function( elem, value ) {
...@@ -392,7 +410,8 @@ if ( !support.opacity ) { ...@@ -392,7 +410,8 @@ if ( !support.opacity ) {
// Force it by setting the zoom level // Force it by setting the zoom level
style.zoom = 1; style.zoom = 1;
// if setting opacity to 1, and no other filters exist - attempt to remove filter attribute #6652 // if setting opacity to 1, and no other filters exist -
// attempt to remove filter attribute #6652
// if value === "", then remove inline opacity #12685 // if value === "", then remove inline opacity #12685
if ( ( value >= 1 || value === "" ) && if ( ( value >= 1 || value === "" ) &&
jQuery.trim( filter.replace( ralpha, "" ) ) === "" && jQuery.trim( filter.replace( ralpha, "" ) ) === "" &&
...@@ -403,7 +422,8 @@ if ( !support.opacity ) { ...@@ -403,7 +422,8 @@ if ( !support.opacity ) {
// style.removeAttribute is IE Only, but so apparently is this code path... // style.removeAttribute is IE Only, but so apparently is this code path...
style.removeAttribute( "filter" ); style.removeAttribute( "filter" );
// if there is no filter style applied in a css rule or unset inline opacity, we are done // if there is no filter style applied in a css rule
// or unset inline opacity, we are done
if ( value === "" || currentStyle && !currentStyle.filter ) { if ( value === "" || currentStyle && !currentStyle.filter ) {
return; return;
} }
......
...@@ -37,9 +37,12 @@ if ( window.getComputedStyle ) { ...@@ -37,9 +37,12 @@ if ( window.getComputedStyle ) {
} }
// A tribute to the "awesome hack by Dean Edwards" // A tribute to the "awesome hack by Dean Edwards"
// Chrome < 17 and Safari 5.0 uses "computed value" instead of "used value" for margin-right // Chrome < 17 and Safari 5.0 uses "computed value"
// Safari 5.1.7 (at least) returns percentage for a larger set of values, but width seems to be reliably pixels // instead of "used value" for margin-right
// this is against the CSSOM draft spec: http://dev.w3.org/csswg/cssom/#resolved-values // Safari 5.1.7 (at least) returns percentage for a larger set of values,
// but width seems to be reliably pixels
// this is against the CSSOM draft spec:
// http://dev.w3.org/csswg/cssom/#resolved-values
if ( rnumnonpx.test( ret ) && rmargin.test( name ) ) { if ( rnumnonpx.test( ret ) && rmargin.test( name ) ) {
// Remember the original values // Remember the original values
...@@ -87,8 +90,10 @@ if ( window.getComputedStyle ) { ...@@ -87,8 +90,10 @@ if ( window.getComputedStyle ) {
// If we're not dealing with a regular pixel number // If we're not dealing with a regular pixel number
// but a number that has a weird ending, we need to convert it to pixels // but a number that has a weird ending, we need to convert it to pixels
// but not position css attributes, as those are proportional to the parent element instead // but not position css attributes, as those are
// and we can't measure the parent instead because it might trigger a "stacking dolls" problem // proportional to the parent element instead
// and we can't measure the parent instead because it
// might trigger a "stacking dolls" problem
if ( rnumnonpx.test( ret ) && !rposition.test( name ) ) { if ( rnumnonpx.test( ret ) && !rposition.test( name ) ) {
// Remember the original values // Remember the original values
......
...@@ -17,9 +17,11 @@ function actualDisplay( name, doc ) { ...@@ -17,9 +17,11 @@ function actualDisplay( name, doc ) {
elem = jQuery( doc.createElement( name ) ).appendTo( doc.body ), elem = jQuery( doc.createElement( name ) ).appendTo( doc.body ),
// getDefaultComputedStyle might be reliably used only on attached element // getDefaultComputedStyle might be reliably used only on attached element
display = window.getDefaultComputedStyle && ( style = window.getDefaultComputedStyle( elem[ 0 ] ) ) ? display = window.getDefaultComputedStyle &&
( style = window.getDefaultComputedStyle( elem[ 0 ] ) ) ?
// Use of this method is a temporary fix (more like optmization) until something better comes along, // Use of this method is a temporary fix (more like optmization)
// until something better comes along,
// since it was removed from specification and supported only in FF // since it was removed from specification and supported only in FF
style.display : jQuery.css( elem[ 0 ], "display" ); style.display : jQuery.css( elem[ 0 ], "display" );
...@@ -45,7 +47,8 @@ function defaultDisplay( nodeName ) { ...@@ -45,7 +47,8 @@ function defaultDisplay( nodeName ) {
if ( display === "none" || !display ) { if ( display === "none" || !display ) {
// Use the already-created iframe if possible // Use the already-created iframe if possible
iframe = (iframe || jQuery( "<iframe frameborder='0' width='0' height='0'/>" )).appendTo( doc.documentElement ); iframe = (iframe || jQuery( "<iframe frameborder='0' width='0' height='0'/>" ))
.appendTo( doc.documentElement );
// Always write a new HTML skeleton so Webkit and Firefox don't choke on reuse // Always write a new HTML skeleton so Webkit and Firefox don't choke on reuse
doc = ( iframe[ 0 ].contentWindow || iframe[ 0 ].contentDocument ).document; doc = ( iframe[ 0 ].contentWindow || iframe[ 0 ].contentDocument ).document;
......
...@@ -8,6 +8,7 @@ define([ ...@@ -8,6 +8,7 @@ define([
// isHidden might be called from jQuery#filter function; // isHidden might be called from jQuery#filter function;
// in that case, element will be second argument // in that case, element will be second argument
elem = el || elem; elem = el || elem;
return jQuery.css( elem, "display" ) === "none" || !jQuery.contains( elem.ownerDocument, elem ); return jQuery.css( elem, "display" ) === "none" ||
!jQuery.contains( elem.ownerDocument, elem );
}; };
}); });
...@@ -26,7 +26,7 @@ function dataAttr( elem, key, data ) { ...@@ -26,7 +26,7 @@ function dataAttr( elem, key, data ) {
+data + "" === data ? +data : +data + "" === data ? +data :
rbrace.test( data ) ? jQuery.parseJSON( data ) : rbrace.test( data ) ? jQuery.parseJSON( data ) :
data; data;
} catch( e ) {} } catch ( e ) {}
// Make sure we set the data so it isn't changed later // Make sure we set the data so it isn't changed later
jQuery.data( elem, key, data ); jQuery.data( elem, key, data );
...@@ -78,7 +78,8 @@ function internalData( elem, name, data, pvt /* Internal Use Only */ ) { ...@@ -78,7 +78,8 @@ function internalData( elem, name, data, pvt /* Internal Use Only */ ) {
// Avoid doing any more work than we need to when trying to get data on an // Avoid doing any more work than we need to when trying to get data on an
// object that has no data at all // object that has no data at all
if ( (!id || !cache[id] || (!pvt && !cache[id].data)) && data === undefined && typeof name === "string" ) { if ( (!id || !cache[id] || (!pvt && !cache[id].data)) &&
data === undefined && typeof name === "string" ) {
return; return;
} }
...@@ -313,7 +314,6 @@ jQuery.fn.extend({ ...@@ -313,7 +314,6 @@ jQuery.fn.extend({
} }
return arguments.length > 1 ? return arguments.length > 1 ?
// Sets one value // Sets one value
this.each(function() { this.each(function() {
jQuery.data( this, key, value ); jQuery.data( this, key, value );
......
...@@ -11,7 +11,7 @@ define([ ...@@ -11,7 +11,7 @@ define([
support.deleteExpando = true; support.deleteExpando = true;
try { try {
delete div.test; delete div.test;
} catch( e ) { } catch ( e ) {
support.deleteExpando = false; support.deleteExpando = false;
} }
} }
......
...@@ -36,7 +36,10 @@ jQuery.extend({ ...@@ -36,7 +36,10 @@ jQuery.extend({
.fail( newDefer.reject ) .fail( newDefer.reject )
.progress( newDefer.notify ); .progress( newDefer.notify );
} else { } else {
newDefer[ tuple[ 0 ] + "With" ]( this === promise ? newDefer.promise() : this, fn ? [ returned ] : arguments ); newDefer[ tuple[ 0 ] + "With" ](
this === promise ? newDefer.promise() : this,
fn ? [ returned ] : arguments
);
} }
}); });
}); });
...@@ -99,9 +102,11 @@ jQuery.extend({ ...@@ -99,9 +102,11 @@ jQuery.extend({
length = resolveValues.length, length = resolveValues.length,
// the count of uncompleted subordinates // the count of uncompleted subordinates
remaining = length !== 1 || ( subordinate && jQuery.isFunction( subordinate.promise ) ) ? length : 0, remaining = length !== 1 ||
( subordinate && jQuery.isFunction( subordinate.promise ) ) ? length : 0,
// the master Deferred. If resolveValues consist of only a single Deferred, just use that. // the master Deferred.
// If resolveValues consist of only a single Deferred, just use that.
deferred = remaining === 1 ? subordinate : jQuery.Deferred(), deferred = remaining === 1 ? subordinate : jQuery.Deferred(),
// Update function for both resolve and progress values // Update function for both resolve and progress values
......
...@@ -6,7 +6,8 @@ define([ ...@@ -6,7 +6,8 @@ define([
// Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods // Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
jQuery.each( { Height: "height", Width: "width" }, function( name, type ) { jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name }, function( defaultExtra, funcName ) { jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name },
function( defaultExtra, funcName ) {
// margin is only for outerHeight, outerWidth // margin is only for outerHeight, outerWidth
jQuery.fn[ funcName ] = function( margin, value ) { jQuery.fn[ funcName ] = function( margin, value ) {
var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ), var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),
...@@ -26,8 +27,10 @@ jQuery.each( { Height: "height", Width: "width" }, function( name, type ) { ...@@ -26,8 +27,10 @@ jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
if ( elem.nodeType === 9 ) { if ( elem.nodeType === 9 ) {
doc = elem.documentElement; doc = elem.documentElement;
// Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height], whichever is greatest // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height],
// unfortunately, this causes bug #3838 in IE6/8 only, but there is currently no good, small way to fix it. // whichever is greatest
// unfortunately, this causes bug #3838 in IE6/8 only,
// but there is currently no good, small way to fix it.
return Math.max( return Math.max(
elem.body[ "scroll" + name ], doc[ "scroll" + name ], elem.body[ "scroll" + name ], doc[ "scroll" + name ],
elem.body[ "offset" + name ], doc[ "offset" + name ], elem.body[ "offset" + name ], doc[ "offset" + name ],
......
...@@ -45,7 +45,8 @@ var ...@@ -45,7 +45,8 @@ var
do { do {
// If previous iteration zeroed out, double until we get *something* // If previous iteration zeroed out, double until we get *something*
// Use a string for doubling factor so we don't accidentally see scale as unchanged below // Use a string for doubling factor so we don't accidentally see scale
// as unchanged below
scale = scale || ".5"; scale = scale || ".5";
// Adjust and apply // Adjust and apply
...@@ -53,8 +54,11 @@ var ...@@ -53,8 +54,11 @@ var
jQuery.style( tween.elem, prop, start + unit ); jQuery.style( tween.elem, prop, start + unit );
// Update scale, tolerating zero or NaN from tween.cur() // Update scale, tolerating zero or NaN from tween.cur()
// And breaking the loop if scale is unchanged or perfect, or if we've just had enough // And breaking the loop if scale is unchanged or perfect,
} while ( scale !== (scale = tween.cur() / target) && scale !== 1 && --maxIterations ); // or if we've just had enough
} while (
scale !== (scale = tween.cur() / target) && scale !== 1 && --maxIterations
);
} }
// Update tween properties // Update tween properties
...@@ -203,7 +207,8 @@ function defaultPrefilter( elem, props, opts ) { ...@@ -203,7 +207,8 @@ function defaultPrefilter( elem, props, opts ) {
toggle = toggle || value === "toggle"; toggle = toggle || value === "toggle";
if ( value === ( hidden ? "hide" : "show" ) ) { if ( value === ( hidden ? "hide" : "show" ) ) {
// If there is dataShow left over from a stopped hide or show and we are going to proceed with show, we should pretend to be hidden // If there is dataShow left over from a stopped hide or show
// and we are going to proceed with show, we should pretend to be hidden
if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) { if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) {
hidden = true; hidden = true;
} else { } else {
...@@ -533,7 +538,9 @@ jQuery.fn.extend({ ...@@ -533,7 +538,9 @@ jQuery.fn.extend({
} }
for ( index = timers.length; index--; ) { for ( index = timers.length; index--; ) {
if ( timers[ index ].elem === this && (type == null || timers[ index ].queue === type) ) { if ( timers[ index ].elem === this &&
(type == null || timers[ index ].queue === type) ) {
timers[ index ].anim.stop( gotoEnd ); timers[ index ].anim.stop( gotoEnd );
dequeue = false; dequeue = false;
timers.splice( index, 1 ); timers.splice( index, 1 );
......
...@@ -77,7 +77,9 @@ Tween.propHooks = { ...@@ -77,7 +77,9 @@ Tween.propHooks = {
// available and use plain properties where available // available and use plain properties where available
if ( jQuery.fx.step[ tween.prop ] ) { if ( jQuery.fx.step[ tween.prop ] ) {
jQuery.fx.step[ tween.prop ]( tween ); jQuery.fx.step[ tween.prop ]( tween );
} else if ( tween.elem.style && ( tween.elem.style[ jQuery.cssProps[ tween.prop ] ] != null || jQuery.cssHooks[ tween.prop ] ) ) { } else if ( tween.elem.style &&
( tween.elem.style[ jQuery.cssProps[ tween.prop ] ] != null ||
jQuery.cssHooks[ tween.prop ] ) ) {
jQuery.style( tween.elem, tween.prop, tween.now + tween.unit ); jQuery.style( tween.elem, tween.prop, tween.now + tween.unit );
} else { } else {
tween.elem[ tween.prop ] = tween.now; tween.elem[ tween.prop ] = tween.now;
......
...@@ -74,7 +74,8 @@ jQuery.event = { ...@@ -74,7 +74,8 @@ jQuery.event = {
jQuery.event.dispatch.apply( eventHandle.elem, arguments ) : jQuery.event.dispatch.apply( eventHandle.elem, arguments ) :
undefined; undefined;
}; };
// Add elem as a property of the handle fn to prevent a memory leak with IE non-native events // Add elem as a property of the handle fn to prevent a memory leak
// with IE non-native events
eventHandle.elem = elem; eventHandle.elem = elem;
} }
...@@ -118,7 +119,9 @@ jQuery.event = { ...@@ -118,7 +119,9 @@ jQuery.event = {
handlers.delegateCount = 0; handlers.delegateCount = 0;
// Only use addEventListener/attachEvent if the special events handler returns false // Only use addEventListener/attachEvent if the special events handler returns false
if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) { if ( !special.setup ||
special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
// Bind the global event handler to the element // Bind the global event handler to the element
if ( elem.addEventListener ) { if ( elem.addEventListener ) {
elem.addEventListener( type, eventHandle, false ); elem.addEventListener( type, eventHandle, false );
...@@ -193,7 +196,8 @@ jQuery.event = { ...@@ -193,7 +196,8 @@ jQuery.event = {
if ( ( mappedTypes || origType === handleObj.origType ) && if ( ( mappedTypes || origType === handleObj.origType ) &&
( !handler || handler.guid === handleObj.guid ) && ( !handler || handler.guid === handleObj.guid ) &&
( !tmp || tmp.test( handleObj.namespace ) ) && ( !tmp || tmp.test( handleObj.namespace ) ) &&
( !selector || selector === handleObj.selector || selector === "**" && handleObj.selector ) ) { ( !selector || selector === handleObj.selector ||
selector === "**" && handleObj.selector ) ) {
handlers.splice( j, 1 ); handlers.splice( j, 1 );
if ( handleObj.selector ) { if ( handleObj.selector ) {
...@@ -208,7 +212,9 @@ jQuery.event = { ...@@ -208,7 +212,9 @@ jQuery.event = {
// Remove generic event handler if we removed something and no more handlers exist // Remove generic event handler if we removed something and no more handlers exist
// (avoids potential for endless recursion during removal of special event handlers) // (avoids potential for endless recursion during removal of special event handlers)
if ( origCount && !handlers.length ) { if ( origCount && !handlers.length ) {
if ( !special.teardown || special.teardown.call( elem, namespaces, elemData.handle ) === false ) { if ( !special.teardown ||
special.teardown.call( elem, namespaces, elemData.handle ) === false ) {
jQuery.removeEvent( elem, type, elemData.handle ); jQuery.removeEvent( elem, type, elemData.handle );
} }
...@@ -261,7 +267,7 @@ jQuery.event = { ...@@ -261,7 +267,7 @@ jQuery.event = {
// Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true) // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true)
event.isTrigger = onlyHandlers ? 2 : 3; event.isTrigger = onlyHandlers ? 2 : 3;
event.namespace = namespaces.join("."); event.namespace = namespaces.join(".");
event.namespace_re = event.namespace ? event.rnamespace = event.namespace ?
new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" ) : new RegExp( "(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)" ) :
null; null;
...@@ -310,7 +316,9 @@ jQuery.event = { ...@@ -310,7 +316,9 @@ jQuery.event = {
special.bindType || type; special.bindType || type;
// jQuery handler // jQuery handler
handle = ( jQuery._data( cur, "events" ) || {} )[ event.type ] && jQuery._data( cur, "handle" ); handle = ( jQuery._data( cur, "events" ) || {} )[ event.type ] &&
jQuery._data( cur, "handle" );
if ( handle ) { if ( handle ) {
handle.apply( cur, data ); handle.apply( cur, data );
} }
...@@ -393,17 +401,19 @@ jQuery.event = { ...@@ -393,17 +401,19 @@ jQuery.event = {
event.currentTarget = matched.elem; event.currentTarget = matched.elem;
j = 0; j = 0;
while ( (handleObj = matched.handlers[ j++ ]) && !event.isImmediatePropagationStopped() ) { while ( (handleObj = matched.handlers[ j++ ]) &&
!event.isImmediatePropagationStopped() ) {
// Triggered event must either 1) have no namespace, or // Triggered event must either 1) have no namespace, or
// 2) have namespace(s) a subset or equal to those in the bound event (both can have no namespace). // 2) have namespace(s) a subset or equal to those in the bound event
if ( !event.namespace_re || event.namespace_re.test( handleObj.namespace ) ) { // (both can have no namespace).
if ( !event.rnamespace || event.rnamespace.test( handleObj.namespace ) ) {
event.handleObj = handleObj; event.handleObj = handleObj;
event.data = handleObj.data; event.data = handleObj.data;
ret = ( (jQuery.event.special[ handleObj.origType ] || {}).handle || handleObj.handler ) ret = ( (jQuery.event.special[ handleObj.origType ] || {}).handle ||
.apply( matched.elem, args ); handleObj.handler ).apply( matched.elem, args );
if ( ret !== undefined ) { if ( ret !== undefined ) {
if ( (event.result = ret) === false ) { if ( (event.result = ret) === false ) {
...@@ -519,7 +529,8 @@ jQuery.event = { ...@@ -519,7 +529,8 @@ jQuery.event = {
}, },
// Includes some event props shared by KeyEvent and MouseEvent // Includes some event props shared by KeyEvent and MouseEvent
props: "altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "), props: ( "altKey bubbles cancelable ctrlKey currentTarget eventPhase " +
"metaKey relatedTarget shiftKey target timeStamp view which" ).split(" "),
fixHooks: {}, fixHooks: {},
...@@ -537,7 +548,8 @@ jQuery.event = { ...@@ -537,7 +548,8 @@ jQuery.event = {
}, },
mouseHooks: { mouseHooks: {
props: "button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "), props: ( "button buttons clientX clientY fromElement offsetX offsetY " +
"pageX pageY screenX screenY toElement" ).split(" "),
filter: function( event, original ) { filter: function( event, original ) {
var body, eventDoc, doc, var body, eventDoc, doc,
button = original.button, button = original.button,
...@@ -549,13 +561,19 @@ jQuery.event = { ...@@ -549,13 +561,19 @@ jQuery.event = {
doc = eventDoc.documentElement; doc = eventDoc.documentElement;
body = eventDoc.body; body = eventDoc.body;
event.pageX = original.clientX + ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) - ( doc && doc.clientLeft || body && body.clientLeft || 0 ); event.pageX = original.clientX +
event.pageY = original.clientY + ( doc && doc.scrollTop || body && body.scrollTop || 0 ) - ( doc && doc.clientTop || body && body.clientTop || 0 ); ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) -
( doc && doc.clientLeft || body && body.clientLeft || 0 );
event.pageY = original.clientY +
( doc && doc.scrollTop || body && body.scrollTop || 0 ) -
( doc && doc.clientTop || body && body.clientTop || 0 );
} }
// Add relatedTarget, if necessary // Add relatedTarget, if necessary
if ( !event.relatedTarget && fromElement ) { if ( !event.relatedTarget && fromElement ) {
event.relatedTarget = fromElement === event.target ? original.toElement : fromElement; event.relatedTarget = fromElement === event.target ?
original.toElement :
fromElement;
} }
// Add which for click: 1 === left; 2 === middle; 3 === right // Add which for click: 1 === left; 2 === middle; 3 === right
...@@ -661,7 +679,8 @@ jQuery.removeEvent = document.removeEventListener ? ...@@ -661,7 +679,8 @@ jQuery.removeEvent = document.removeEventListener ?
if ( elem.detachEvent ) { if ( elem.detachEvent ) {
// #8545, #7054, preventing memory leaks for custom events in IE6-8 // #8545, #7054, preventing memory leaks for custom events in IE6-8
// detachEvent needed property on element, by name of that event, to properly expose it to GC // detachEvent needed property on element, by name of that event,
// to properly expose it to GC
if ( typeof elem[ name ] === strundefined ) { if ( typeof elem[ name ] === strundefined ) {
elem[ name ] = null; elem[ name ] = null;
} }
...@@ -804,10 +823,13 @@ if ( !support.submitBubbles ) { ...@@ -804,10 +823,13 @@ if ( !support.submitBubbles ) {
jQuery.event.add( this, "click._submit keypress._submit", function( e ) { jQuery.event.add( this, "click._submit keypress._submit", function( e ) {
// Node name check avoids a VML-related crash in IE (#9807) // Node name check avoids a VML-related crash in IE (#9807)
var elem = e.target, var elem = e.target,
form = jQuery.nodeName( elem, "input" ) || jQuery.nodeName( elem, "button" ) ? elem.form : undefined; form = jQuery.nodeName( elem, "input" ) || jQuery.nodeName( elem, "button" ) ?
elem.form :
undefined;
if ( form && !jQuery._data( form, "submitBubbles" ) ) { if ( form && !jQuery._data( form, "submitBubbles" ) ) {
jQuery.event.add( form, "submit._submit", function( event ) { jQuery.event.add( form, "submit._submit", function( event ) {
event._submit_bubble = true; event._submitBubble = true;
}); });
jQuery._data( form, "submitBubbles", true ); jQuery._data( form, "submitBubbles", true );
} }
...@@ -817,8 +839,8 @@ if ( !support.submitBubbles ) { ...@@ -817,8 +839,8 @@ if ( !support.submitBubbles ) {
postDispatch: function( event ) { postDispatch: function( event ) {
// If form was submitted by the user, bubble the event up the tree // If form was submitted by the user, bubble the event up the tree
if ( event._submit_bubble ) { if ( event._submitBubble ) {
delete event._submit_bubble; delete event._submitBubble;
if ( this.parentNode && !event.isTrigger ) { if ( this.parentNode && !event.isTrigger ) {
jQuery.event.simulate( "submit", this.parentNode, event, true ); jQuery.event.simulate( "submit", this.parentNode, event, true );
} }
...@@ -851,12 +873,12 @@ if ( !support.changeBubbles ) { ...@@ -851,12 +873,12 @@ if ( !support.changeBubbles ) {
if ( this.type === "checkbox" || this.type === "radio" ) { if ( this.type === "checkbox" || this.type === "radio" ) {
jQuery.event.add( this, "propertychange._change", function( event ) { jQuery.event.add( this, "propertychange._change", function( event ) {
if ( event.originalEvent.propertyName === "checked" ) { if ( event.originalEvent.propertyName === "checked" ) {
this._just_changed = true; this._justChanged = true;
} }
}); });
jQuery.event.add( this, "click._change", function( event ) { jQuery.event.add( this, "click._change", function( event ) {
if ( this._just_changed && !event.isTrigger ) { if ( this._justChanged && !event.isTrigger ) {
this._just_changed = false; this._justChanged = false;
} }
// Allow triggered, simulated change events (#11500) // Allow triggered, simulated change events (#11500)
jQuery.event.simulate( "change", this, event, true ); jQuery.event.simulate( "change", this, event, true );
...@@ -883,7 +905,9 @@ if ( !support.changeBubbles ) { ...@@ -883,7 +905,9 @@ if ( !support.changeBubbles ) {
var elem = event.target; var elem = event.target;
// Swallow native change events from checkbox/radio, we already triggered them above // Swallow native change events from checkbox/radio, we already triggered them above
if ( this !== elem || event.isSimulated || event.isTrigger || (elem.type !== "radio" && elem.type !== "checkbox") ) { if ( this !== elem || event.isSimulated || event.isTrigger ||
(elem.type !== "radio" && elem.type !== "checkbox") ) {
return event.handleObj.handler.apply( this, arguments ); return event.handleObj.handler.apply( this, arguments );
} }
}, },
...@@ -994,7 +1018,9 @@ jQuery.fn.extend({ ...@@ -994,7 +1018,9 @@ jQuery.fn.extend({
// ( event ) dispatched jQuery.Event // ( event ) dispatched jQuery.Event
handleObj = types.handleObj; handleObj = types.handleObj;
jQuery( types.delegateTarget ).off( jQuery( types.delegateTarget ).off(
handleObj.namespace ? handleObj.origType + "." + handleObj.namespace : handleObj.origType, handleObj.namespace ?
handleObj.origType + "." + handleObj.namespace :
handleObj.origType,
handleObj.selector, handleObj.selector,
handleObj.handler handleObj.handler
); );
......
...@@ -4,7 +4,14 @@ define([ ...@@ -4,7 +4,14 @@ define([
], function( jQuery ) { ], function( jQuery ) {
// Attach a bunch of functions for handling common AJAX events // Attach a bunch of functions for handling common AJAX events
jQuery.each( [ "ajaxStart", "ajaxStop", "ajaxComplete", "ajaxError", "ajaxSuccess", "ajaxSend" ], function( i, type ) { jQuery.each([
"ajaxStart",
"ajaxStop",
"ajaxComplete",
"ajaxError",
"ajaxSuccess",
"ajaxSend"
], function( i, type ) {
jQuery.fn[ type ] = function( fn ) { jQuery.fn[ type ] = function( fn ) {
return this.on( type, fn ); return this.on( type, fn );
}; };
......
...@@ -5,7 +5,8 @@ define([ ...@@ -5,7 +5,8 @@ define([
jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " + jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " +
"mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " + "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
"change select submit keydown keypress keyup error contextmenu").split(" "), function( i, name ) { "change select submit keydown keypress keyup error contextmenu").split(" "),
function( i, name ) {
// Handle event binding // Handle event binding
jQuery.fn[ name ] = function( data, fn ) { jQuery.fn[ name ] = function( data, fn ) {
...@@ -32,7 +33,9 @@ jQuery.fn.extend({ ...@@ -32,7 +33,9 @@ jQuery.fn.extend({
}, },
undelegate: function( selector, types, fn ) { undelegate: function( selector, types, fn ) {
// ( namespace ) or ( selector, types [, fn] ) // ( namespace ) or ( selector, types [, fn] )
return arguments.length === 1 ? this.off( selector, "**" ) : this.off( types, selector || "**", fn ); return arguments.length === 1 ?
this.off( selector, "**" ) :
this.off( types, selector || "**", fn );
} }
}); });
......
...@@ -29,7 +29,8 @@ function createSafeFragment( document ) { ...@@ -29,7 +29,8 @@ function createSafeFragment( document ) {
return safeFrag; return safeFrag;
} }
var nodeNames = "abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|" + var nodeNames = "abbr|article|aside|audio|bdi|canvas|data|" +
"datalist|details|figcaption|figure|footer|" +
"header|hgroup|mark|meter|nav|output|progress|section|summary|time|video", "header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",
rinlinejQuery = / jQuery\d+="(?:null|\d+)"/g, rinlinejQuery = / jQuery\d+="(?:null|\d+)"/g,
rnoshimcache = new RegExp("<(?:" + nodeNames + ")[\\s/>]", "i"), rnoshimcache = new RegExp("<(?:" + nodeNames + ")[\\s/>]", "i"),
...@@ -70,9 +71,11 @@ wrapMap.th = wrapMap.td; ...@@ -70,9 +71,11 @@ wrapMap.th = wrapMap.td;
function getAll( context, tag ) { function getAll( context, tag ) {
var elems, elem, var elems, elem,
i = 0, i = 0,
found = typeof context.getElementsByTagName !== strundefined ? context.getElementsByTagName( tag || "*" ) : found = typeof context.getElementsByTagName !== strundefined ?
typeof context.querySelectorAll !== strundefined ? context.querySelectorAll( tag || "*" ) : context.getElementsByTagName( tag || "*" ) :
undefined; typeof context.querySelectorAll !== strundefined ?
context.querySelectorAll( tag || "*" ) :
undefined;
if ( !found ) { if ( !found ) {
for ( found = [], elems = context.childNodes || context; (elem = elems[i]) != null; i++ ) { for ( found = [], elems = context.childNodes || context; (elem = elems[i]) != null; i++ ) {
...@@ -127,7 +130,11 @@ function setGlobalEval( elems, refElements ) { ...@@ -127,7 +130,11 @@ function setGlobalEval( elems, refElements ) {
var elem, var elem,
i = 0; i = 0;
for ( ; (elem = elems[i]) != null; i++ ) { for ( ; (elem = elems[i]) != null; i++ ) {
jQuery._data( elem, "globalEval", !refElements || jQuery._data( refElements[i], "globalEval" ) ); jQuery._data(
elem,
"globalEval",
!refElements || jQuery._data( refElements[i], "globalEval" )
);
} }
} }
...@@ -231,7 +238,9 @@ jQuery.extend({ ...@@ -231,7 +238,9 @@ jQuery.extend({
var destElements, node, clone, i, srcElements, var destElements, node, clone, i, srcElements,
inPage = jQuery.contains( elem.ownerDocument, elem ); inPage = jQuery.contains( elem.ownerDocument, elem );
if ( support.html5Clone || jQuery.isXMLDoc(elem) || !rnoshimcache.test( "<" + elem.nodeName + ">" ) ) { if ( support.html5Clone || jQuery.isXMLDoc(elem) ||
!rnoshimcache.test( "<" + elem.nodeName + ">" ) ) {
clone = elem.cloneNode( true ); clone = elem.cloneNode( true );
// IE<=8 does not properly clone detached, unknown element nodes // IE<=8 does not properly clone detached, unknown element nodes
...@@ -341,7 +350,9 @@ jQuery.extend({ ...@@ -341,7 +350,9 @@ jQuery.extend({
j = elem && elem.childNodes.length; j = elem && elem.childNodes.length;
while ( j-- ) { while ( j-- ) {
if ( jQuery.nodeName( (tbody = elem.childNodes[j]), "tbody" ) && !tbody.childNodes.length ) { if ( jQuery.nodeName( (tbody = elem.childNodes[j]), "tbody" ) &&
!tbody.childNodes.length ) {
elem.removeChild( tbody ); elem.removeChild( tbody );
} }
} }
...@@ -467,7 +478,9 @@ jQuery.fn.extend({ ...@@ -467,7 +478,9 @@ jQuery.fn.extend({
return access( this, function( value ) { return access( this, function( value ) {
return value === undefined ? return value === undefined ?
jQuery.text( this ) : jQuery.text( this ) :
this.empty().append( ( this[0] && this[0].ownerDocument || document ).createTextNode( value ) ); this.empty().append(
( this[0] && this[0].ownerDocument || document ).createTextNode( value )
);
}, null, value, arguments.length ); }, null, value, arguments.length );
}, },
...@@ -594,7 +607,7 @@ jQuery.fn.extend({ ...@@ -594,7 +607,7 @@ jQuery.fn.extend({
elem = 0; elem = 0;
// If using innerHTML throws an exception, use the fallback method // If using innerHTML throws an exception, use the fallback method
} catch(e) {} } catch ( e ) {}
} }
if ( elem ) { if ( elem ) {
...@@ -664,7 +677,8 @@ jQuery.fn.extend({ ...@@ -664,7 +677,8 @@ jQuery.fn.extend({
scripts = jQuery.map( getAll( fragment, "script" ), disableScript ); scripts = jQuery.map( getAll( fragment, "script" ), disableScript );
hasScripts = scripts.length; hasScripts = scripts.length;
// Use the original fragment for the last item instead of the first because it can end up // Use the original fragment for the last item
// instead of the first because it can end up
// being emptied incorrectly in certain situations (#8070). // being emptied incorrectly in certain situations (#8070).
for ( ; i < l; i++ ) { for ( ; i < l; i++ ) {
node = fragment; node = fragment;
...@@ -691,7 +705,8 @@ jQuery.fn.extend({ ...@@ -691,7 +705,8 @@ jQuery.fn.extend({
for ( i = 0; i < hasScripts; i++ ) { for ( i = 0; i < hasScripts; i++ ) {
node = scripts[ i ]; node = scripts[ i ];
if ( rscriptType.test( node.type || "" ) && if ( rscriptType.test( node.type || "" ) &&
!jQuery._data( node, "globalEval" ) && jQuery.contains( doc, node ) ) { !jQuery._data( node, "globalEval" ) &&
jQuery.contains( doc, node ) ) {
if ( node.src ) { if ( node.src ) {
// Optional AJAX dependency, but won't run scripts if not present // Optional AJAX dependency, but won't run scripts if not present
...@@ -699,7 +714,10 @@ jQuery.fn.extend({ ...@@ -699,7 +714,10 @@ jQuery.fn.extend({
jQuery._evalUrl( node.src ); jQuery._evalUrl( node.src );
} }
} else { } else {
jQuery.globalEval( ( node.text || node.textContent || node.innerHTML || "" ).replace( rcleanScript, "" ) ); jQuery.globalEval(
( node.text || node.textContent || node.innerHTML || "" )
.replace( rcleanScript, "" )
);
} }
} }
} }
......
...@@ -65,7 +65,7 @@ define([ ...@@ -65,7 +65,7 @@ define([
support.deleteExpando = true; support.deleteExpando = true;
try { try {
delete div.test; delete div.test;
} catch( e ) { } catch ( e ) {
support.deleteExpando = false; support.deleteExpando = false;
} }
} }
......
...@@ -46,7 +46,8 @@ jQuery.offset = { ...@@ -46,7 +46,8 @@ jQuery.offset = {
calculatePosition = ( position === "absolute" || position === "fixed" ) && calculatePosition = ( position === "absolute" || position === "fixed" ) &&
jQuery.inArray("auto", [ curCSSTop, curCSSLeft ] ) > -1; jQuery.inArray("auto", [ curCSSTop, curCSSLeft ] ) > -1;
// need to be able to calculate position if either top or left is auto and position is either absolute or fixed // need to be able to calculate position if either top or left
// is auto and position is either absolute or fixed
if ( calculatePosition ) { if ( calculatePosition ) {
curPosition = curElem.position(); curPosition = curElem.position();
curTop = curPosition.top; curTop = curPosition.top;
...@@ -122,7 +123,8 @@ jQuery.fn.extend({ ...@@ -122,7 +123,8 @@ jQuery.fn.extend({
parentOffset = { top: 0, left: 0 }, parentOffset = { top: 0, left: 0 },
elem = this[ 0 ]; elem = this[ 0 ];
// fixed elements are offset from window (parentOffset = {top:0, left: 0}, because it is its only offset parent // Fixed elements are offset from window (parentOffset = {top:0, left: 0},
// because it is its only offset parent
if ( jQuery.css( elem, "position" ) === "fixed" ) { if ( jQuery.css( elem, "position" ) === "fixed" ) {
// we assume that getBoundingClientRect is available when computed position is fixed // we assume that getBoundingClientRect is available when computed position is fixed
offset = elem.getBoundingClientRect(); offset = elem.getBoundingClientRect();
...@@ -154,7 +156,8 @@ jQuery.fn.extend({ ...@@ -154,7 +156,8 @@ jQuery.fn.extend({
return this.map(function() { return this.map(function() {
var offsetParent = this.offsetParent || docElem; var offsetParent = this.offsetParent || docElem;
while ( offsetParent && ( !jQuery.nodeName( offsetParent, "html" ) && jQuery.css( offsetParent, "position" ) === "static" ) ) { while ( offsetParent && ( !jQuery.nodeName( offsetParent, "html" ) &&
jQuery.css( offsetParent, "position" ) === "static" ) ) {
offsetParent = offsetParent.offsetParent; offsetParent = offsetParent.offsetParent;
} }
return offsetParent || docElem; return offsetParent || docElem;
......
...@@ -59,7 +59,8 @@ jQuery.extend({ ...@@ -59,7 +59,8 @@ jQuery.extend({
} }
}, },
// not intended for public consumption - generates a queueHooks object, or returns the current one // not intended for public consumption - generates a queueHooks object,
// or returns the current one
_queueHooks: function( elem, type ) { _queueHooks: function( elem, type ) {
var key = type + "queueHooks"; var key = type + "queueHooks";
return jQuery._data( elem, key ) || jQuery._data( elem, key, { return jQuery._data( elem, key ) || jQuery._data( elem, key, {
......
...@@ -24,7 +24,12 @@ function buildParams( prefix, obj, traditional, add ) { ...@@ -24,7 +24,12 @@ function buildParams( prefix, obj, traditional, add ) {
} else { } else {
// Item is non-scalar (array or object), encode its numeric index. // Item is non-scalar (array or object), encode its numeric index.
buildParams( prefix + "[" + ( typeof v === "object" ? i : "" ) + "]", v, traditional, add ); buildParams(
prefix + "[" + ( typeof v === "object" ? i : "" ) + "]",
v,
traditional,
add
);
} }
}); });
......
...@@ -20,7 +20,9 @@ jQuery.extend({ ...@@ -20,7 +20,9 @@ jQuery.extend({
var matched = [], var matched = [],
cur = elem[ dir ]; cur = elem[ dir ];
while ( cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery( cur ).is( until )) ) { while ( cur && cur.nodeType !== 9 &&
(until === undefined || cur.nodeType !== 1 || !jQuery( cur ).is( until )) ) {
if ( cur.nodeType === 1 ) { if ( cur.nodeType === 1 ) {
matched.push( cur ); matched.push( cur );
} }
......
...@@ -224,7 +224,8 @@ this.testIframe = function( fileName, name, fn ) { ...@@ -224,7 +224,8 @@ this.testIframe = function( fileName, name, fn ) {
function loadFixture() { function loadFixture() {
var src = url( "./data/" + fileName + ".html" ), var src = url( "./data/" + fileName + ".html" ),
iframe = jQuery( "<iframe />" ).appendTo( "body" )[ 0 ]; iframe = jQuery( "<iframe />" ).appendTo( "body" )[ 0 ];
iframe.style.cssText = "width: 500px; height: 500px; position: absolute; top: -600px; left: -600px; visibility: hidden;"; iframe.style.cssText = "width: 500px; height: 500px; position: absolute; " +
"top: -600px; left: -600px; visibility: hidden;";
iframe.contentWindow.location = src; iframe.contentWindow.location = src;
return iframe; return iframe;
...@@ -307,7 +308,8 @@ this.loadTests = function() { ...@@ -307,7 +308,8 @@ this.loadTests = function() {
// Load the TestSwarm listener if swarmURL is in the address. // Load the TestSwarm listener if swarmURL is in the address.
if ( loadSwarm ) { if ( loadSwarm ) {
require( [ "http://swarm.jquery.org/js/inject.js?" + (new Date()).getTime() ], function() { require( [ "http://swarm.jquery.org/js/inject.js?" + (new Date()).getTime() ],
function() {
QUnit.start(); QUnit.start();
}); });
} else { } else {
......
...@@ -44,12 +44,13 @@ function keys( o ) { ...@@ -44,12 +44,13 @@ function keys( o ) {
* @param {string} key * @param {string} key
*/ */
QUnit.expectJqData = function( elems, key ) { QUnit.expectJqData = function( elems, key ) {
var i, elem, expando; var i, elem, expando,
currentEnv = "current_testEnvironment";
// As of jQuery 2.0, there will be no "cache"-data is // As of jQuery 2.0, there will be no "cache"-data is
// stored and managed completely below the API surface // stored and managed completely below the API surface
if ( jQuery.cache ) { if ( jQuery.cache ) {
QUnit.current_testEnvironment.checkJqData = true; QUnit[ currentEnv ].checkJqData = true;
if ( elems.jquery && elems.toArray ) { if ( elems.jquery && elems.toArray ) {
elems = elems.toArray(); elems = elems.toArray();
...@@ -81,7 +82,12 @@ QUnit.expectJqData = function( elems, key ) { ...@@ -81,7 +82,12 @@ QUnit.expectJqData = function( elems, key ) {
// Since this method was called it means some data was // Since this method was called it means some data was
// expected to be found, but since there is nothing, fail early // expected to be found, but since there is nothing, fail early
// (instead of in teardown). // (instead of in teardown).
notStrictEqual( expando, undefined, "Target for expectJqData must have an expando, for else there can be no data to expect." ); notStrictEqual(
expando,
undefined,
"Target for expectJqData must have an expando, " +
"for else there can be no data to expect."
);
} else { } else {
if ( expectedDataKeys[ expando ] ) { if ( expectedDataKeys[ expando ] ) {
expectedDataKeys[ expando ].push( key ); expectedDataKeys[ expando ].push( key );
...@@ -96,7 +102,8 @@ QUnit.expectJqData = function( elems, key ) { ...@@ -96,7 +102,8 @@ QUnit.expectJqData = function( elems, key ) {
QUnit.config.urlConfig.push({ QUnit.config.urlConfig.push({
id: "jqdata", id: "jqdata",
label: "Always check jQuery.data", label: "Always check jQuery.data",
tooltip: "Trigger QUnit.expectJqData detection for all tests instead of just the ones that call it" tooltip: "Trigger QUnit.expectJqData detection for all tests " +
"instead of just the ones that call it"
}); });
/** /**
...@@ -122,7 +129,11 @@ window.moduleTeardown = function() { ...@@ -122,7 +129,11 @@ window.moduleTeardown = function() {
} }
// In case it was removed from cache before (or never there in the first place) // In case it was removed from cache before (or never there in the first place)
for ( i in expectedDataKeys ) { for ( i in expectedDataKeys ) {
deepEqual( expectedDataKeys[ i ], undefined, "No unexpected keys were left in jQuery.cache (#" + i + " )" ); deepEqual(
expectedDataKeys[ i ],
undefined,
"No unexpected keys were left in jQuery.cache (#" + i + ")"
);
delete expectedDataKeys[ i ]; delete expectedDataKeys[ i ];
} }
} }
...@@ -150,8 +161,10 @@ window.moduleTeardown = function() { ...@@ -150,8 +161,10 @@ window.moduleTeardown = function() {
++cacheLength; ++cacheLength;
} }
// Because QUnit doesn't have a mechanism for retrieving the number of expected assertions for a test, // Because QUnit doesn't have a mechanism for retrieving
// if we unconditionally assert any of these, the test will fail with too many assertions :| // the number of expected assertions for a test,
// if we unconditionally assert any of these,
// the test will fail with too many assertions :|
if ( cacheLength !== oldCacheLength ) { if ( cacheLength !== oldCacheLength ) {
equal( cacheLength, oldCacheLength, "No unit tests leak memory in jQuery.cache" ); equal( cacheLength, oldCacheLength, "No unit tests leak memory in jQuery.cache" );
oldCacheLength = cacheLength; oldCacheLength = cacheLength;
...@@ -200,7 +213,8 @@ window.Globals = (function() { ...@@ -200,7 +213,8 @@ window.Globals = (function() {
globals = {}; globals = {};
for ( name in current ) { for ( name in current ) {
supportjQuery.globalEval( "try { " + supportjQuery.globalEval( "try { " +
"delete " + ( supportjQuery.support.deleteExpando ? "window['" + name + "']" : name ) + "delete " +
( supportjQuery.support.deleteExpando ? "window['" + name + "']" : name ) +
"; } catch( x ) {}" ); "; } catch( x ) {}" );
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment