aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorOleg <markelog@gmail.com>2013-09-11 05:08:01 +0400
committerOleg <markelog@gmail.com>2013-09-13 01:04:29 +0400
commitcb37994d76afb45efc3b606546349ed4e695c053 (patch)
tree8deabef18039a4f90b7f8035775dcd4bd3474495 /src
parente12746d756ef32124b163136fe49e753b35c7111 (diff)
downloadjquery-cb37994d76afb45efc3b606546349ed4e695c053.tar.gz
jquery-cb37994d76afb45efc3b606546349ed4e695c053.zip
No ticket: fix code style inconsistencies. Closes gh-1361
Diffstat (limited to 'src')
-rw-r--r--src/ajax.js10
-rw-r--r--src/ajax/parseXML.js2
-rw-r--r--src/ajax/xhr.js2
-rw-r--r--src/attributes/support.js2
-rw-r--r--src/attributes/val.js4
-rw-r--r--src/callbacks.js2
-rw-r--r--src/css/support.js2
-rw-r--r--src/deferred.js2
-rw-r--r--src/effects.js7
-rw-r--r--src/effects/Tween.js2
-rw-r--r--src/event.js6
-rw-r--r--src/manipulation.js7
-rw-r--r--src/offset.js2
-rw-r--r--src/queue.js2
-rw-r--r--src/serialize.js11
15 files changed, 32 insertions, 31 deletions
diff --git a/src/ajax.js b/src/ajax.js
index 364e5a4b6..15a5e9d3b 100644
--- a/src/ajax.js
+++ b/src/ajax.js
@@ -102,7 +102,7 @@ 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;
@@ -146,7 +146,7 @@ function ajaxHandleResponses( s, jqXHR, responses ) {
dataTypes = s.dataTypes;
// Remove auto dataType and get content-type in the process
- while( dataTypes[ 0 ] === "*" ) {
+ while ( dataTypes[ 0 ] === "*" ) {
dataTypes.shift();
if ( ct === undefined ) {
ct = s.mimeType || jqXHR.getResponseHeader("Content-Type");
@@ -510,7 +510,7 @@ jQuery.extend({
s.type = options.method || options.type || s.method || s.type;
// Extract dataTypes list
- s.dataTypes = jQuery.trim( s.dataType || "*" ).toLowerCase().match( rnotwhite ) || [""];
+ s.dataTypes = jQuery.trim( s.dataType || "*" ).toLowerCase().match( rnotwhite ) || [ "" ];
// A cross-domain request is in order when we have a protocol:host:port mismatch
if ( s.crossDomain == null ) {
@@ -796,8 +796,8 @@ jQuery.each( [ "get", "post" ], function( i, method ) {
});
// Attach a bunch of functions for handling common AJAX events
-jQuery.each( [ "ajaxStart", "ajaxStop", "ajaxComplete", "ajaxError", "ajaxSuccess", "ajaxSend" ], function( i, type ){
- jQuery.fn[ type ] = function( fn ){
+jQuery.each( [ "ajaxStart", "ajaxStop", "ajaxComplete", "ajaxError", "ajaxSuccess", "ajaxSend" ], function( i, type ) {
+ jQuery.fn[ type ] = function( fn ) {
return this.on( type, fn );
};
});
diff --git a/src/ajax/parseXML.js b/src/ajax/parseXML.js
index aa80e3620..9eeb625ff 100644
--- a/src/ajax/parseXML.js
+++ b/src/ajax/parseXML.js
@@ -12,7 +12,7 @@ jQuery.parseXML = function( data ) {
// Support: IE9
try {
tmp = new DOMParser();
- xml = tmp.parseFromString( data , "text/xml" );
+ xml = tmp.parseFromString( data, "text/xml" );
} catch ( e ) {
xml = undefined;
}
diff --git a/src/ajax/xhr.js b/src/ajax/xhr.js
index e08cfcac3..8e6696b0d 100644
--- a/src/ajax/xhr.js
+++ b/src/ajax/xhr.js
@@ -26,7 +26,7 @@ var xhrSupported = jQuery.ajaxSettings.xhr(),
if ( window.ActiveXObject ) {
jQuery( window ).on( "unload", function() {
- for( var key in xhrCallbacks ) {
+ for ( var key in xhrCallbacks ) {
xhrCallbacks[ key ]();
}
xhrCallbacks = undefined;
diff --git a/src/attributes/support.js b/src/attributes/support.js
index 08c2caf08..376b54ad2 100644
--- a/src/attributes/support.js
+++ b/src/attributes/support.js
@@ -2,7 +2,7 @@ define([
"../var/support"
], function( support ) {
-(function () {
+(function() {
var input = document.createElement( "input" ),
select = document.createElement( "select" ),
opt = select.appendChild( document.createElement( "option" ) );
diff --git a/src/attributes/val.js b/src/attributes/val.js
index 65d772cc2..6fc4a84bb 100644
--- a/src/attributes/val.js
+++ b/src/attributes/val.js
@@ -49,10 +49,12 @@ jQuery.fn.extend({
// Treat null/undefined as ""; convert numbers to string
if ( val == null ) {
val = "";
+
} else if ( typeof val === "number" ) {
val += "";
+
} else if ( jQuery.isArray( val ) ) {
- val = jQuery.map(val, function ( value ) {
+ val = jQuery.map( val, function( value ) {
return value == null ? "" : value + "";
});
}
diff --git a/src/callbacks.js b/src/callbacks.js
index ed725b498..17572bb9c 100644
--- a/src/callbacks.js
+++ b/src/callbacks.js
@@ -126,7 +126,7 @@ jQuery.Callbacks = function( options ) {
if ( list ) {
jQuery.each( arguments, function( _, arg ) {
var index;
- while( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {
+ while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {
list.splice( index, 1 );
// Handle firing indexes
if ( firing ) {
diff --git a/src/css/support.js b/src/css/support.js
index 9b882897d..336449085 100644
--- a/src/css/support.js
+++ b/src/css/support.js
@@ -3,7 +3,7 @@ define([
"../var/support"
], function( jQuery, support ) {
-(function () {
+(function() {
var pixelPositionVal, boxSizingReliableVal,
// Support: Firefox, Android 2.3 (Prefixed box-sizing versions).
divReset = "padding:0;margin:0;border:0;display:block;-webkit-box-sizing:content-box;" +
diff --git a/src/deferred.js b/src/deferred.js
index 1c2f87e86..7fcc214ac 100644
--- a/src/deferred.js
+++ b/src/deferred.js
@@ -109,7 +109,7 @@ jQuery.extend({
return function( value ) {
contexts[ i ] = this;
values[ i ] = arguments.length > 1 ? slice.call( arguments ) : value;
- if( values === progressValues ) {
+ if ( values === progressValues ) {
deferred.notifyWith( contexts, values );
} else if ( !( --remaining ) ) {
deferred.resolveWith( contexts, values );
diff --git a/src/effects.js b/src/effects.js
index b2d206850..611336053 100644
--- a/src/effects.js
+++ b/src/effects.js
@@ -14,7 +14,7 @@ var
rrun = /queueHooks$/,
animationPrefilters = [ defaultPrefilter ],
tweeners = {
- "*": [function( prop, value ) {
+ "*": [ function( prop, value ) {
var tween = this.createTween( prop, value ),
target = tween.cur(),
parts = rfxnum.exec( value ),
@@ -61,7 +61,7 @@ var
}
return tween;
- }]
+ } ]
};
// Dependencies not needed as vars
@@ -89,7 +89,7 @@ function genFx( type, includeWidth ) {
// if we include width, step value is 1 to do all cssExpand values,
// if we don't include width, step value is 2 to skip over Left and Right
includeWidth = includeWidth ? 1 : 0;
- for( ; i < 4 ; i += 2 - includeWidth ) {
+ for ( ; i < 4 ; i += 2 - includeWidth ) {
which = cssExpand[ i ];
attrs[ "margin" + which ] = attrs[ "padding" + which ] = type;
}
@@ -181,7 +181,6 @@ function defaultPrefilter( elem, props, opts ) {
});
}
-
// show/hide pass
for ( prop in props ) {
value = props[ prop ];
diff --git a/src/effects/Tween.js b/src/effects/Tween.js
index 582d42a8b..d1e4dca8b 100644
--- a/src/effects/Tween.js
+++ b/src/effects/Tween.js
@@ -102,7 +102,7 @@ jQuery.easing = {
return p;
},
swing: function( p ) {
- return 0.5 - Math.cos( p*Math.PI ) / 2;
+ return 0.5 - Math.cos( p * Math.PI ) / 2;
}
};
diff --git a/src/event.js b/src/event.js
index 866e4f0dd..d07f24764 100644
--- a/src/event.js
+++ b/src/event.js
@@ -81,7 +81,7 @@ jQuery.event = {
}
// Handle multiple events separated by a space
- types = ( types || "" ).match( rnotwhite ) || [""];
+ types = ( types || "" ).match( rnotwhite ) || [ "" ];
t = types.length;
while ( t-- ) {
tmp = rtypenamespace.exec( types[t] ) || [];
@@ -163,7 +163,7 @@ jQuery.event = {
}
// Once for each type.namespace in types; type may be omitted
- types = ( types || "" ).match( rnotwhite ) || [""];
+ types = ( types || "" ).match( rnotwhite ) || [ "" ];
t = types.length;
while ( t-- ) {
tmp = rtypenamespace.exec( types[t] ) || [];
@@ -538,7 +538,7 @@ jQuery.event = {
event.target = event.target.parentNode;
}
- return fixHook.filter? fixHook.filter( event, originalEvent ) : event;
+ return fixHook.filter ? fixHook.filter( event, originalEvent ) : event;
},
special: {
diff --git a/src/manipulation.js b/src/manipulation.js
index c51175570..7e5ec07cc 100644
--- a/src/manipulation.js
+++ b/src/manipulation.js
@@ -1,6 +1,6 @@
// Require more than a few needed variables
// Keep in mind that a dependency array cannot be used with CommonJS+AMD syntax
-define(function( require ){
+define(function( require ) {
var
jQuery = require( "./core" ),
@@ -48,7 +48,6 @@ require( "./traversing" );
require( "./selector" );
require( "./event" );
-
// Support: 1.x compatibility
// Manipulating tables requires a tbody
function manipulationTarget( elem, content ) {
@@ -218,7 +217,7 @@ jQuery.extend({
tmp = tmp || fragment.appendChild( context.createElement("div") );
// Deserialize a standard representation
- tag = ( rtagName.exec( elem ) || ["", ""] )[ 1 ].toLowerCase();
+ tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase();
wrap = wrapMap[ tag ] || wrapMap._default;
tmp.innerHTML = wrap[ 1 ] + elem.replace( rxhtmlTag, "<$1></$2>" ) + wrap[ 2 ];
@@ -398,7 +397,7 @@ jQuery.fn.extend({
dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
- return this.map( function () {
+ return this.map(function() {
return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
});
},
diff --git a/src/offset.js b/src/offset.js
index 9809d1079..6396e0f38 100644
--- a/src/offset.js
+++ b/src/offset.js
@@ -158,7 +158,7 @@ jQuery.fn.extend({
});
// Create scrollLeft and scrollTop methods
-jQuery.each( {scrollLeft: "pageXOffset", scrollTop: "pageYOffset"}, function( method, prop ) {
+jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) {
var top = "pageYOffset" === prop;
jQuery.fn[ method ] = function( val ) {
diff --git a/src/queue.js b/src/queue.js
index f72c5adac..fbfaf9ca5 100644
--- a/src/queue.js
+++ b/src/queue.js
@@ -126,7 +126,7 @@ jQuery.fn.extend({
}
type = type || "fx";
- while( i-- ) {
+ while ( i-- ) {
tmp = data_priv.get( elements[ i ], type + "queueHooks" );
if ( tmp && tmp.empty ) {
count++;
diff --git a/src/serialize.js b/src/serialize.js
index 797d735aa..fc1b4dfdf 100644
--- a/src/serialize.js
+++ b/src/serialize.js
@@ -80,25 +80,26 @@ jQuery.fn.extend({
return jQuery.param( this.serializeArray() );
},
serializeArray: function() {
- return this.map(function(){
+ return this.map(function() {
// Can add propHook for "elements" to filter or add form elements
var elements = jQuery.prop( this, "elements" );
return elements ? jQuery.makeArray( elements ) : this;
})
- .filter(function(){
+ .filter(function() {
var type = this.type;
- // Use .is(":disabled") so that fieldset[disabled] works
+
+ // Use .is( ":disabled" ) so that fieldset[ disabled ] works
return this.name && !jQuery( this ).is( ":disabled" ) &&
rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) &&
( this.checked || !rcheckableType.test( type ) );
})
- .map(function( i, elem ){
+ .map(function( i, elem ) {
var val = jQuery( this ).val();
return val == null ?
null :
jQuery.isArray( val ) ?
- jQuery.map( val, function( val ){
+ jQuery.map( val, function( val ) {
return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
}) :
{ name: elem.name, value: val.replace( rCRLF, "\r\n" ) };