From c869a1ef8a031342e817a2c063179a787ff57239 Mon Sep 17 00:00:00 2001 From: Timmy Willison Date: Thu, 17 Jul 2014 10:25:59 -0700 Subject: [PATCH] Build: update grunt-jscs-checker and pass with the new rules --- Gruntfile.js | 32 ++++++++--- build/release-notes.js | 3 +- build/release.js | 4 +- build/tasks/build.js | 36 ++++++++---- package.json | 2 +- src/ajax.js | 23 +++++--- src/ajax/jsonp.js | 4 +- src/ajax/script.js | 3 +- src/ajax/xhr.js | 10 +++- src/attributes/attr.js | 4 +- src/attributes/classes.js | 18 ++++-- src/attributes/prop.js | 7 ++- src/attributes/val.js | 9 ++- src/callbacks.js | 4 +- src/core.js | 7 ++- src/core/init.js | 5 +- src/core/parseHTML.js | 3 +- src/core/ready.js | 6 +- src/css.js | 46 ++++++++++----- src/css/curCSS.js | 6 +- src/css/defaultDisplay.js | 15 +++-- src/css/var/isHidden.js | 3 +- src/data.js | 42 +++++++------- src/data/var/{data_priv.js => dataPriv.js} | 0 src/data/var/{data_user.js => dataUser.js} | 0 src/deferred.js | 11 +++- src/dimensions.js | 4 +- src/effects.js | 29 ++++++---- src/effects/Tween.js | 4 +- src/event.js | 65 +++++++++++++--------- src/event/ajax.js | 9 ++- src/event/alias.js | 7 ++- src/manipulation.js | 40 ++++++------- src/offset.js | 6 +- src/queue.js | 14 ++--- src/selector-native.js | 18 +++--- src/serialize.js | 7 ++- test/data/testinit.js | 6 +- test/data/testrunner.js | 27 ++++++--- 39 files changed, 352 insertions(+), 187 deletions(-) rename src/data/var/{data_priv.js => dataPriv.js} (100%) rename src/data/var/{data_user.js => dataUser.js} (100%) diff --git a/Gruntfile.js b/Gruntfile.js index 1daa03a3d..8eff10144 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -19,7 +19,7 @@ module.exports = function( grunt ) { grunt.initConfig({ pkg: grunt.file.readJSON( "package.json" ), dst: readOptionalJSON( "dist/.destination.json" ), - compare_size: { + "compare_size": { files: [ "dist/jquery.js", "dist/jquery.min.js" ], options: { compress: { @@ -93,13 +93,31 @@ module.exports = function( grunt ) { src: "src/**/*.js", gruntfile: "Gruntfile.js", - // Right know, check only test helpers - test: [ "test/data/testrunner.js", "test/data/testinit.js" ], - release: "build/*.js", + // Right now, check only test helpers + test: [ "test/data/testrunner.js" ], + release: [ "build/*.js", "!build/release-notes.js" ], tasks: "build/tasks/*.js" }, 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: { files: [ "<%= jshint.all.src %>" ], @@ -116,13 +134,13 @@ module.exports = function( grunt ) { sourceMappingURL: "jquery.min.map", report: "min", beautify: { - ascii_only: true + "ascii_only": true }, banner: "/*! jQuery v<%= pkg.version %> | " + "(c) 2005, <%= grunt.template.today('yyyy') %> jQuery Foundation, Inc. | " + "jquery.org/license */", compress: { - hoist_funs: false, + "hoist_funs": false, loops: false, unused: false } diff --git a/build/release-notes.js b/build/release-notes.js index c9676f28f..00cdc8659 100644 --- a/build/release-notes.js +++ b/build/release-notes.js @@ -16,7 +16,8 @@ http.request({ host: "bugs.jquery.com", port: 80, 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 ) { var data = []; diff --git a/build/release.js b/build/release.js index 9f6b2e2a9..e6b429eed 100644 --- a/build/release.js +++ b/build/release.js @@ -89,7 +89,9 @@ module.exports = function( Release ) { var archiver = require( "archiver" )( "zip" ), 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 ) { throw err; diff --git a/build/tasks/build.js b/build/tasks/build.js index 03aacf9eb..a64481fe6 100644 --- a/build/tasks/build.js +++ b/build/tasks/build.js @@ -1,6 +1,7 @@ /** * 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 ) { @@ -35,7 +36,8 @@ module.exports = function( grunt ) { /** * Strip all definitions generated by requirejs * 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 * @param {String} name * @param {String} path @@ -98,7 +100,8 @@ module.exports = function( grunt ) { grunt.registerMultiTask( "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() { var flag, index, done = this.async(), @@ -113,7 +116,8 @@ module.exports = function( grunt ) { /** * Recursively calls the excluder to remove on all modules in the 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 ) { if ( list ) { @@ -121,7 +125,9 @@ module.exports = function( grunt ) { list.forEach(function( module ) { // Exclude var modules as well if ( module === "var" ) { - excludeList( fs.readdirSync( srcFolder + prepend + module ), prepend + module ); + excludeList( + fs.readdirSync( srcFolder + prepend + module ), prepend + module + ); return; } if ( prepend ) { @@ -143,7 +149,9 @@ module.exports = function( grunt ) { }, /** * 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 ) { var m = /^(\+|\-|)([\w\/-]+)$/.exec( flag ), @@ -162,7 +170,7 @@ module.exports = function( grunt ) { // It's fine if the directory is not there try { excludeList( fs.readdirSync( srcFolder + module ), module ); - } catch( e ) { + } catch ( e ) { grunt.verbose.writeln( e ); } } @@ -171,7 +179,9 @@ module.exports = function( grunt ) { } else { grunt.log.error( "Module \"" + module + "\" is a mimimum requirement."); if ( module === "selector" ) { - grunt.log.error( "If you meant to replace Sizzle, use -sizzle instead." ); + grunt.log.error( + "If you meant to replace Sizzle, use -sizzle instead." + ); } } } else { @@ -195,8 +205,10 @@ module.exports = function( grunt ) { // * none (implicit exclude) // *:* all (implicit include) // *:*:-css all except css and dependents (explicit > implicit) - // *:*:-css:+effects same (excludes effects because explicit include is trumped by explicit exclude of dependency) - // *:+effects none except effects and its dependencies (explicit include trumps implicit exclude of dependency) + // *:*:-css:+effects same (excludes effects because explicit include is + // trumped by explicit exclude of dependency) + // *:+effects none except effects and its dependencies + // (explicit include trumps implicit exclude of dependency) delete flags[ "*" ]; for ( flag in flags ) { excluder( flag ); @@ -249,7 +261,9 @@ module.exports = function( grunt ) { // Turn off opt-in if necessary if ( !optIn ) { // 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 diff --git a/package.json b/package.json index c54885f7a..26100c684 100644 --- a/package.json +++ b/package.json @@ -39,7 +39,7 @@ "grunt-contrib-uglify": "0.5.0", "grunt-contrib-watch": "0.6.1", "grunt-git-authors": "1.2.0", - "grunt-jscs-checker": "0.4.1", + "grunt-jscs-checker": "0.6.1", "grunt-jsonlint": "1.0.4", "grunt-npmcopy": "0.1.0", "gzip-js": "0.3.2", diff --git a/src/ajax.js b/src/ajax.js index fff7cbd6b..400108e1c 100644 --- a/src/ajax.js +++ b/src/ajax.js @@ -89,7 +89,9 @@ function inspectPrefiltersOrTransports( structure, options, originalOptions, jqX inspected[ dataType ] = true; jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) { var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR ); - if ( typeof dataTypeOrTransport === "string" && !seekingTransport && !inspected[ dataTypeOrTransport ] ) { + if ( typeof dataTypeOrTransport === "string" && + !seekingTransport && !inspected[ dataTypeOrTransport ] ) { + options.dataTypes.unshift( dataTypeOrTransport ); inspect( dataTypeOrTransport ); return false; @@ -262,7 +264,10 @@ function ajaxConvert( s, response, jqXHR, isSuccess ) { try { response = conv( response ); } 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 + }; } } } @@ -396,9 +401,10 @@ jQuery.extend({ // Callbacks context callbackContext = s.context || s, // Context for global events is callbackContext if it is a DOM node or jQuery collection - globalEventContext = s.context && ( callbackContext.nodeType || callbackContext.jquery ) ? - jQuery( callbackContext ) : - jQuery.event, + globalEventContext = s.context && + ( callbackContext.nodeType || callbackContext.jquery ) ? + jQuery( callbackContext ) : + jQuery.event, // Deferreds deferred = jQuery.Deferred(), completeDeferred = jQuery.Callbacks("once memory"), @@ -582,7 +588,8 @@ jQuery.extend({ jqXHR.setRequestHeader( "Accept", 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[ "*" ] ); @@ -592,7 +599,9 @@ jQuery.extend({ } // 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 return jqXHR.abort(); } diff --git a/src/ajax/jsonp.js b/src/ajax/jsonp.js index ff0d53899..d7ca7e1a7 100644 --- a/src/ajax/jsonp.js +++ b/src/ajax/jsonp.js @@ -24,7 +24,9 @@ jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) { var callbackName, overwritten, responseContainer, jsonProp = s.jsonp !== false && ( rjsonp.test( s.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 diff --git a/src/ajax/script.js b/src/ajax/script.js index f44329d4e..e5ad4d8f9 100644 --- a/src/ajax/script.js +++ b/src/ajax/script.js @@ -6,7 +6,8 @@ define([ // Install script dataType jQuery.ajaxSetup({ accepts: { - script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript" + script: "text/javascript, application/javascript, " + + "application/ecmascript, application/x-ecmascript" }, contents: { script: /(?:java|ecma)script/ diff --git a/src/ajax/xhr.js b/src/ajax/xhr.js index bdeeee3f8..a733eded0 100644 --- a/src/ajax/xhr.js +++ b/src/ajax/xhr.js @@ -7,7 +7,7 @@ define([ jQuery.ajaxSettings.xhr = function() { try { return new XMLHttpRequest(); - } catch( e ) {} + } catch ( e ) {} }; var xhrId = 0, @@ -45,7 +45,13 @@ jQuery.ajaxTransport(function( options ) { xhr = options.xhr(), id = ++xhrId; - 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 if ( options.xhrFields ) { diff --git a/src/attributes/attr.js b/src/attributes/attr.js index a4414d11f..facdd411a 100644 --- a/src/attributes/attr.js +++ b/src/attributes/attr.js @@ -50,7 +50,9 @@ jQuery.extend({ if ( value === null ) { 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; } else { diff --git a/src/attributes/classes.js b/src/attributes/classes.js index 101138415..c6178246b 100644 --- a/src/attributes/classes.js +++ b/src/attributes/classes.js @@ -2,9 +2,9 @@ define([ "../core", "../var/rnotwhite", "../var/strundefined", - "../data/var/data_priv", + "../data/var/dataPriv", "../core/init" -], function( jQuery, rnotwhite, strundefined, data_priv ) { +], function( jQuery, rnotwhite, strundefined, dataPriv ) { var rclass = /[\t\r\n\f]/g; @@ -104,7 +104,9 @@ jQuery.fn.extend({ if ( jQuery.isFunction( value ) ) { 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 + ); }); } @@ -129,14 +131,16 @@ jQuery.fn.extend({ } else if ( type === strundefined || type === "boolean" ) { if ( this.className ) { // store className if set - data_priv.set( this, "__className__", this.className ); + dataPriv.set( this, "__className__", this.className ); } // If the element has a class name or if we're passed `false`, // then remove the whole classname (if there was one, the above saved it). // Otherwise bring back whatever was previously saved (if anything), // falling back to the empty string if nothing was stored. - this.className = this.className || value === false ? "" : data_priv.get( this, "__className__" ) || ""; + this.className = this.className || value === false ? + "" : + dataPriv.get( this, "__className__" ) || ""; } }); }, @@ -146,7 +150,9 @@ jQuery.fn.extend({ i = 0, l = this.length; 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; } } diff --git a/src/attributes/prop.js b/src/attributes/prop.js index d4ee8b6b9..58ed76511 100644 --- a/src/attributes/prop.js +++ b/src/attributes/prop.js @@ -56,9 +56,10 @@ jQuery.extend({ propHooks: { tabIndex: { get: function( elem ) { - return elem.hasAttribute( "tabindex" ) || rfocusable.test( elem.nodeName ) || elem.href ? - elem.tabIndex : - -1; + return elem.hasAttribute( "tabindex" ) || + rfocusable.test( elem.nodeName ) || elem.href ? + elem.tabIndex : + -1; } } } diff --git a/src/attributes/val.js b/src/attributes/val.js index 4a1358a65..3130b56d1 100644 --- a/src/attributes/val.js +++ b/src/attributes/val.js @@ -13,7 +13,8 @@ jQuery.fn.extend({ if ( !arguments.length ) { 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 ) { return ret; @@ -100,8 +101,10 @@ jQuery.extend({ // IE6-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 - ( support.optDisabled ? !option.disabled : option.getAttribute( "disabled" ) === null ) && - ( !option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" ) ) ) { + ( support.optDisabled ? + !option.disabled : option.getAttribute( "disabled" ) === null ) && + ( !option.parentNode.disabled || + !jQuery.nodeName( option.parentNode, "optgroup" ) ) ) { // Get the specific value for the option value = jQuery( option ).val(); diff --git a/src/callbacks.js b/src/callbacks.js index 17572bb9c..30fa1a30f 100644 --- a/src/callbacks.js +++ b/src/callbacks.js @@ -70,7 +70,9 @@ jQuery.Callbacks = function( options ) { firingLength = list.length; firing = true; 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 break; } diff --git a/src/core.js b/src/core.js index 15e2077aa..2b3fbb180 100644 --- a/src/core.js +++ b/src/core.js @@ -162,7 +162,9 @@ jQuery.extend = jQuery.fn.extend = function() { } // 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 ) { copyIsArray = false; clone = src && jQuery.isArray(src) ? src : []; @@ -458,7 +460,8 @@ jQuery.extend({ }); // 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(); }); diff --git a/src/core/init.js b/src/core/init.js index 7e83a0496..e49196a96 100644 --- a/src/core/init.js +++ b/src/core/init.js @@ -23,7 +23,10 @@ var rootjQuery, // Handle HTML strings if ( typeof selector === "string" ) { - if ( selector[0] === "<" && selector[ selector.length - 1 ] === ">" && selector.length >= 3 ) { + if ( selector[0] === "<" && + selector[ selector.length - 1 ] === ">" && + selector.length >= 3 ) { + // Assume that strings that start and end with <> are HTML and skip the regex check match = [ null, selector, null ]; diff --git a/src/core/parseHTML.js b/src/core/parseHTML.js index 64cf2a18a..808d60e3d 100644 --- a/src/core/parseHTML.js +++ b/src/core/parseHTML.js @@ -5,7 +5,8 @@ define([ ], function( jQuery, rsingleTag ) { // 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 jQuery.parseHTML = function( data, context, keepScripts ) { if ( !data || typeof data !== "string" ) { diff --git a/src/core/ready.js b/src/core/ready.js index db1a6e60a..8cef55124 100644 --- a/src/core/ready.js +++ b/src/core/ready.js @@ -72,8 +72,10 @@ jQuery.ready.promise = function( obj ) { readyList = jQuery.Deferred(); - // Catch cases where $(document).ready() is called after the browser event has already occurred. - // We once tried to use readyState "interactive" here, but it caused issues like the one + // Catch cases where $(document).ready() is called + // after the browser event has already occurred. + // 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" ) { // Handle it asynchronously to allow scripts the opportunity to delay ready diff --git a/src/css.js b/src/css.js index d4816175d..fc4524ed0 100644 --- a/src/css.js +++ b/src/css.js @@ -11,17 +11,18 @@ define([ "./css/defaultDisplay", "./css/addGetHookIf", "./css/support", - "./data/var/data_priv", + "./data/var/dataPriv", "./core/init", "./css/swap", "./core/ready", "./selector" // contains ], function( jQuery, pnum, access, rmargin, rnumnonpx, cssExpand, isHidden, - getStyles, curCSS, defaultDisplay, addGetHookIf, support, data_priv ) { + getStyles, curCSS, defaultDisplay, addGetHookIf, support, dataPriv ) { var - // 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 "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]).+)/, rnumsplit = new RegExp( "^(" + pnum + ")(.*)$", "i" ), @@ -161,7 +162,7 @@ function showHide( elements, show ) { continue; } - values[ index ] = data_priv.get( elem, "olddisplay" ); + values[ index ] = dataPriv.get( elem, "olddisplay" ); display = elem.style.display; if ( show ) { // Reset the inline display of this element to learn if it is @@ -174,13 +175,21 @@ function showHide( elements, show ) { // in a stylesheet to whatever the default browser style is // for such an element if ( elem.style.display === "" && isHidden( elem ) ) { - values[ index ] = data_priv.access( elem, "olddisplay", defaultDisplay(elem.nodeName) ); + values[ index ] = dataPriv.access( + elem, + "olddisplay", + defaultDisplay(elem.nodeName) + ); } } else { hidden = isHidden( elem ); if ( display !== "none" || !hidden ) { - data_priv.set( elem, "olddisplay", hidden ? display : jQuery.css( elem, "display" ) ); + dataPriv.set( + elem, + "olddisplay", + hidden ? display : jQuery.css( elem, "display" ) + ); } } } @@ -252,7 +261,8 @@ jQuery.extend({ origName = jQuery.camelCase( name ), 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, then unprefixed version hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; @@ -285,13 +295,17 @@ jQuery.extend({ } // 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 ) { + style[ name ] = value; } } else { // 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; } @@ -305,7 +319,8 @@ jQuery.extend({ origName = jQuery.camelCase( 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 ) ); // Try prefixed name followed by the unprefixed name hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; @@ -341,11 +356,12 @@ jQuery.each([ "height", "width" ], function( i, name ) { // Certain elements can have dimension info if we invisibly show them // but it must have a current display style that would benefit - return rdisplayswap.test( jQuery.css( elem, "display" ) ) && elem.offsetWidth === 0 ? - jQuery.swap( elem, cssShow, function() { - return getWidthOrHeight( elem, name, extra ); - }) : - getWidthOrHeight( elem, name, extra ); + return rdisplayswap.test( jQuery.css( elem, "display" ) ) && + elem.offsetWidth === 0 ? + jQuery.swap( elem, cssShow, function() { + return getWidthOrHeight( elem, name, extra ); + }) : + getWidthOrHeight( elem, name, extra ); } }, diff --git a/src/css/curCSS.js b/src/css/curCSS.js index 90e508cb8..420d19fa9 100644 --- a/src/css/curCSS.js +++ b/src/css/curCSS.js @@ -26,8 +26,10 @@ function curCSS( elem, name, computed ) { // Support: iOS < 6 // A tribute to the "awesome hack by Dean Edwards" - // iOS < 6 (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 + // iOS < 6 (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 ) ) { // Remember the original values diff --git a/src/css/defaultDisplay.js b/src/css/defaultDisplay.js index 046ae91b9..0090ca644 100644 --- a/src/css/defaultDisplay.js +++ b/src/css/defaultDisplay.js @@ -17,11 +17,15 @@ function actualDisplay( name, doc ) { elem = jQuery( doc.createElement( name ) ).appendTo( doc.body ), // 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 optimization) until something better comes along, - // since it was removed from specification and supported only in FF - style.display : jQuery.css( elem[ 0 ], "display" ); + // Use of this method is a temporary fix (more like optimization) + // until something better comes along, + // since it was removed from specification and supported only in FF + style.display : + + jQuery.css( elem[ 0 ], "display" ); // We don't have any data stored on the element, // so use "detach" method as fast way to get rid of the element @@ -45,7 +49,8 @@ function defaultDisplay( nodeName ) { if ( display === "none" || !display ) { // Use the already-created iframe if possible - iframe = (iframe || jQuery( "