Skip to content
Permalink
Browse files

Make sure that when multiple variables are being declared that assign…

…ments are each done on their own line.
  • Loading branch information...
jeresig committed Nov 9, 2010
1 parent b5b3c73 commit fb48ae8e6cca25fd29ef2b1eb23e9efa7b0eef7c
Showing with 98 additions and 45 deletions.
  1. +6 −5 src/ajax.js
  2. +8 −3 src/attributes.js
  3. +7 −3 src/core.js
  4. +5 −2 src/css.js
  5. +2 −1 src/data.js
  6. +3 −1 src/dimensions.js
  7. +6 −2 src/effects.js
  8. +19 −9 src/event.js
  9. +21 −10 src/manipulation.js
  10. +11 −5 src/offset.js
  11. +2 −1 src/queue.js
  12. +8 −3 src/traversing.js
@@ -506,11 +506,12 @@ jQuery.extend({
// Serialize an array of form elements or a set of
// key/values into a query string
param: function( a, traditional ) {
var s = [], add = function( key, value ) {
// If value is a function, invoke it and return its value
value = jQuery.isFunction(value) ? value() : value;
s[ s.length ] = encodeURIComponent(key) + "=" + encodeURIComponent(value);
};
var s = [],
add = function( key, value ) {
// If value is a function, invoke it and return its value
value = jQuery.isFunction(value) ? value() : value;
s[ s.length ] = encodeURIComponent(key) + "=" + encodeURIComponent(value);
};

// Set traditional to true for jQuery <= 1.3.2 behavior.
if ( traditional === undefined ) {
@@ -55,7 +55,9 @@ jQuery.fn.extend({
elem.className = value;

} else {
var className = " " + elem.className + " ", setClass = elem.className;
var className = " " + elem.className + " ",
setClass = elem.className;

for ( var c = 0, cl = classNames.length; c < cl; c++ ) {
if ( className.indexOf( " " + classNames[c] + " " ) < 0 ) {
setClass += " " + classNames[c];
@@ -103,7 +105,8 @@ jQuery.fn.extend({
},

toggleClass: function( value, stateVal ) {
var type = typeof value, isBool = typeof stateVal === "boolean";
var type = typeof value,
isBool = typeof stateVal === "boolean";

if ( jQuery.isFunction( value ) ) {
return this.each(function(i) {
@@ -115,7 +118,9 @@ jQuery.fn.extend({
return this.each(function() {
if ( type === "string" ) {
// toggle individual class names
var className, i = 0, self = jQuery(this),
var className,
i = 0,
self = jQuery( this ),
state = stateVal,
classNames = value.split( rspaces );

@@ -311,8 +311,11 @@ jQuery.fn = jQuery.prototype = {
jQuery.fn.init.prototype = jQuery.fn;

jQuery.extend = jQuery.fn.extend = function() {
// copy reference to target object
var target = arguments[0] || {}, i = 1, length = arguments.length, deep = false, options, name, src, copy, copyIsArray, clone;
var options, name, src, copy, copyIsArray, clone,
target = arguments[0] || {},
i = 1,
length = arguments.length,
deep = false;

// Handle a deep copy situation
if ( typeof target === "boolean" ) {
@@ -678,7 +681,8 @@ jQuery.extend({
},

merge: function( first, second ) {
var i = first.length, j = 0;
var i = first.length,
j = 0;

if ( typeof second.length === "number" ) {
for ( var l = second.length; j < l; j++ ) {
@@ -258,7 +258,9 @@ if ( document.defaultView && document.defaultView.getComputedStyle ) {

if ( document.documentElement.currentStyle ) {
currentStyle = function( elem, name ) {
var left, rsLeft, ret = elem.currentStyle && elem.currentStyle[ name ], style = elem.style;
var left, rsLeft,
ret = elem.currentStyle && elem.currentStyle[ name ],
style = elem.style;

// From the awesome hack by Dean Edwards
// http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291
@@ -312,7 +314,8 @@ function getWH( elem, name, extra ) {

if ( jQuery.expr && jQuery.expr.filters ) {
jQuery.expr.filters.hidden = function( elem ) {
var width = elem.offsetWidth, height = elem.offsetHeight;
var width = elem.offsetWidth,
height = elem.offsetHeight;

return (width === 0 && height === 0) || (!jQuery.support.reliableHiddenOffsets && (elem.style.display || jQuery.css( elem, "display" )) === "none");
};
@@ -177,7 +177,8 @@ jQuery.fn.extend({

} else {
return this.each(function() {
var $this = jQuery( this ), args = [ parts[0], value ];
var $this = jQuery( this ),
args = [ parts[0], value ];

$this.triggerHandler( "setData" + parts[1] + "!", args );
jQuery.data( this, key, value );
@@ -49,7 +49,9 @@ jQuery.each([ "Height", "Width" ], function( i, name ) {

// Get or set width or height on the element
} else if ( size === undefined ) {
var orig = jQuery.css( elem, type ), ret = parseFloat( orig );
var orig = jQuery.css( elem, type ),
ret = parseFloat( orig );

return jQuery.isNaN( ret ) ? orig : ret;

// Set the width or height on the element (default to pixels if value is unitless)
@@ -342,14 +342,16 @@ jQuery.fx.prototype = {

// Start an animation from one number to another
custom: function( from, to, unit ) {
var self = this,
fx = jQuery.fx;

this.startTime = jQuery.now();
this.start = from;
this.end = to;
this.unit = unit || this.unit || "px";
this.now = this.start;
this.pos = this.state = 0;

var self = this, fx = jQuery.fx;
function t( gotoEnd ) {
return self.step(gotoEnd);
}
@@ -406,7 +408,9 @@ jQuery.fx.prototype = {
if ( done ) {
// Reset the overflow
if ( this.options.overflow != null && !jQuery.support.shrinkWrapBlocks ) {
var elem = this.elem, options = this.options;
var elem = this.elem,
options = this.options;

jQuery.each( [ "", "X", "Y" ], function (index, value) {
elem.style[ "overflow" + value ] = options.overflow[index];
} );
@@ -378,8 +378,10 @@ jQuery.event = {
jQuery.event.trigger( event, data, parent, true );

} else if ( !event.isDefaultPrevented() ) {
var target = event.target, old, targetType = type.replace(rnamespaces, ""),
isClick = jQuery.nodeName(target, "a") && targetType === "click",
var old,
target = event.target,
targetType = type.replace( rnamespaces, "" ),
isClick = jQuery.nodeName( target, "a" ) && targetType === "click",
special = jQuery.event.special[ targetType ] || {};

if ( (!special._default || special._default.call( elem, event ) === false) &&
@@ -411,7 +413,9 @@ jQuery.event = {
},

handle: function( event ) {
var all, handlers, namespaces, namespace_sort = [], namespace_re, events, args = jQuery.makeArray( arguments );
var all, handlers, namespaces, namespace_re, events,
namespace_sort = [],
args = jQuery.makeArray( arguments );

event = args[0] = jQuery.event.fix( event || window.event );
event.currentTarget = this;
@@ -506,7 +510,9 @@ jQuery.event = {

// Calculate pageX/Y if missing and clientX/Y available
if ( event.pageX == null && event.clientX != null ) {
var doc = document.documentElement, body = document.body;
var doc = document.documentElement,
body = document.body;

event.pageX = event.clientX + (doc && doc.scrollLeft || body && body.scrollLeft || 0) - (doc && doc.clientLeft || body && body.clientLeft || 0);
event.pageY = event.clientY + (doc && doc.scrollTop || body && body.scrollTop || 0) - (doc && doc.clientTop || body && body.clientTop || 0);
}
@@ -712,7 +718,8 @@ if ( !jQuery.support.submitBubbles ) {
setup: function( data, namespaces ) {
if ( this.nodeName.toLowerCase() !== "form" ) {
jQuery.event.add(this, "click.specialSubmit", function( e ) {
var elem = e.target, type = elem.type;
var elem = e.target,
type = elem.type;

if ( (type === "submit" || type === "image") && jQuery( elem ).closest("form").length ) {
e.liveFired = undefined;
@@ -721,7 +728,8 @@ if ( !jQuery.support.submitBubbles ) {
});

jQuery.event.add(this, "keypress.specialSubmit", function( e ) {
var elem = e.target, type = elem.type;
var elem = e.target,
type = elem.type;

if ( (type === "text" || type === "password") && jQuery( elem ).closest("form").length && e.keyCode === 13 ) {
e.liveFired = undefined;
@@ -962,7 +970,8 @@ jQuery.fn.extend({

toggle: function( fn ) {
// Save reference to arguments for access in closure
var args = arguments, i = 1;
var args = arguments,
i = 1;

// link all the functions, so any of them can unbind this click handler
while ( i < args.length ) {
@@ -1057,8 +1066,9 @@ jQuery.each(["live", "die"], function( i, name ) {
});

function liveHandler( event ) {
var stop, maxLevel, elems = [], selectors = [],
related, match, handleObj, elem, j, i, l, data, close, namespace, ret,
var stop, maxLevel, related, match, handleObj, elem, j, i, l, data, close, namespace, ret,
elems = [],
selectors = [],
events = jQuery.data( this, this.nodeType ? "events" : "__events__" );

if ( typeof events === "function" ) {
@@ -34,7 +34,8 @@ jQuery.fn.extend({
text: function( text ) {
if ( jQuery.isFunction(text) ) {
return this.each(function(i) {
var self = jQuery(this);
var self = jQuery( this );

self.text( text.call(this, i, self.text()) );
});
}
@@ -83,7 +84,8 @@ jQuery.fn.extend({
}

return this.each(function() {
var self = jQuery( this ), contents = self.contents();
var self = jQuery( this ),
contents = self.contents();

if ( contents.length ) {
contents.wrapAll( html );
@@ -194,7 +196,9 @@ jQuery.fn.extend({
// attributes in IE that are actually only stored
// as properties will not be copied (such as the
// the name attribute on an input).
var html = this.outerHTML, ownerDocument = this.ownerDocument;
var html = this.outerHTML,
ownerDocument = this.ownerDocument;

if ( !html ) {
var div = ownerDocument.createElement("div");
div.appendChild( this.cloneNode(true) );
@@ -249,7 +253,8 @@ jQuery.fn.extend({

} else if ( jQuery.isFunction( value ) ) {
this.each(function(i){
var self = jQuery(this);
var self = jQuery( this );

self.html( value.call(this, i, self.html()) );
});

@@ -272,13 +277,14 @@ jQuery.fn.extend({
}

if ( typeof value !== "string" ) {
value = jQuery(value).detach();
value = jQuery( value ).detach();
}

return this.each(function() {
var next = this.nextSibling, parent = this.parentNode;
var next = this.nextSibling,
parent = this.parentNode;

jQuery(this).remove();
jQuery( this ).remove();

if ( next ) {
jQuery(next).before( value );
@@ -296,7 +302,9 @@ jQuery.fn.extend({
},

domManip: function( args, table, callback ) {
var results, first, value = args[0], scripts = [], fragment, parent;
var results, first, fragment, parent,
value = args[0],
scripts = [];

// We can't cloneNode fragments that contain checked, in WebKit
if ( !jQuery.support.checkClone && arguments.length === 3 && typeof value === "string" && rchecked.test( value ) ) {
@@ -371,7 +379,9 @@ function cloneCopyEvent(orig, ret) {
return;
}

var oldData = jQuery.data( orig[i++] ), curData = jQuery.data( this, oldData ), events = oldData && oldData.events;
var oldData = jQuery.data( orig[i++] ),
curData = jQuery.data( this, oldData ),
events = oldData && oldData.events;

if ( events ) {
delete curData.handle;
@@ -428,7 +438,8 @@ jQuery.each({
replaceAll: "replaceWith"
}, function( name, original ) {
jQuery.fn[ name ] = function( selector ) {
var ret = [], insert = jQuery( selector ),
var ret = [],
insert = jQuery( selector ),
parent = this.length === 1 && this[0].parentNode;

if ( parent && parent.nodeType === 11 && parent.childNodes.length === 1 && insert.length === 1 ) {
@@ -65,11 +65,16 @@ if ( "getBoundingClientRect" in document.documentElement ) {

jQuery.offset.initialize();

var offsetParent = elem.offsetParent, prevOffsetParent = elem,
doc = elem.ownerDocument, computedStyle, docElem = doc.documentElement,
body = doc.body, defaultView = doc.defaultView,
var computedStyle,
offsetParent = elem.offsetParent,
prevOffsetParent = elem,
doc = elem.ownerDocument,
docElem = doc.documentElement,
body = doc.body,
defaultView = doc.defaultView,
prevComputedStyle = defaultView ? defaultView.getComputedStyle( elem, null ) : elem.currentStyle,
top = elem.offsetTop, left = elem.offsetLeft;
top = elem.offsetTop,
left = elem.offsetLeft;

while ( (elem = elem.parentNode) && elem !== body && elem !== docElem ) {
if ( jQuery.offset.supportsFixedPosition && prevComputedStyle.position === "fixed" ) {
@@ -151,7 +156,8 @@ jQuery.offset = {
},

bodyOffset: function( body ) {
var top = body.offsetTop, left = body.offsetLeft;
var top = body.offsetTop,
left = body.offsetLeft;

jQuery.offset.initialize();

@@ -27,7 +27,8 @@ jQuery.extend({
dequeue: function( elem, type ) {
type = type || "fx";

var queue = jQuery.queue( elem, type ), fn = queue.shift();
var queue = jQuery.queue( elem, type ),
fn = queue.shift();

// If the fx queue is dequeued, always remove the progress sentinel
if ( fn === "inprogress" ) {
@@ -10,7 +10,8 @@ var runtil = /Until$/,

jQuery.fn.extend({
find: function( selector ) {
var ret = this.pushStack( "", "find", selector ), length = 0;
var ret = this.pushStack( "", "find", selector ),
length = 0;

for ( var i = 0, l = this.length; i < l; i++ ) {
length = ret.length;
@@ -59,7 +60,9 @@ jQuery.fn.extend({
var ret = [], i, l, cur = this[0];

if ( jQuery.isArray( selectors ) ) {
var match, matches = {}, selector, level = 1;
var match, selector,
matches = {},
level = 1;

if ( cur && selectors.length ) {
for ( i = 0, l = selectors.length; i < l; i++ ) {
@@ -225,7 +228,9 @@ jQuery.extend({
},

dir: function( elem, dir, until ) {
var matched = [], cur = elem[dir];
var matched = [],
cur = elem[ dir ];

while ( cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery( cur ).is( until )) ) {
if ( cur.nodeType === 1 ) {
matched.push( cur );

0 comments on commit fb48ae8

Please sign in to comment.
You can’t perform that action at this time.