]> source.dussan.org Git - jquery.git/commitdiff
Make sure that when multiple variables are being declared that assignments are each...
authorJohn Resig <jeresig@gmail.com>
Tue, 9 Nov 2010 16:09:07 +0000 (11:09 -0500)
committerJohn Resig <jeresig@gmail.com>
Tue, 9 Nov 2010 16:09:07 +0000 (11:09 -0500)
12 files changed:
src/ajax.js
src/attributes.js
src/core.js
src/css.js
src/data.js
src/dimensions.js
src/effects.js
src/event.js
src/manipulation.js
src/offset.js
src/queue.js
src/traversing.js

index ff293da6acff9280097a5fcaba2c9e35e87d5032..9195bcc89eb48d44cd0e34edfeccdfdb524d8618 100644 (file)
@@ -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 ) {
index 4393a9fdbc38a449f279d752a83e218db8ab3efb..be221afa3d687527df9698061db8e808b0fb4436 100644 (file)
@@ -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 );
 
index 3a37c4a890400e5f79ee6abe6d43151d2002224a..8940ada2bdf37aec3a7296d2dc38ccb852c5c27e 100644 (file)
@@ -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++ ) {
index 1fbee3f4719639146de6b6b7290f547902ec8943..4665fa7cbbe671b8c34fca4143fe21aa2971f5b8 100644 (file)
@@ -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");
        };
index 0407f73ffd299cd1404e84fb96dc59b6c2e0ecae..f7f65efeb7d93e6330cbac26da77b79a0542defc 100644 (file)
@@ -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 );
index f5212e1b6b9b67ffc8cf0b9560f2a31f1403d75d..f35b0acfb8020df6c5f5f43366c65422efed3c59 100644 (file)
@@ -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)
index e95741c065083da7038f2dcda44ce5d2dfa9859d..51ce0c5772c54dcf6a1e94fc657c917ccbbf06c3 100644 (file)
@@ -342,6 +342,9 @@ 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;
@@ -349,7 +352,6 @@ jQuery.fx.prototype = {
                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];
                                        } );
index 04bf168ed53fb6f62ab01d7e7fbe36e64e5e846d..3cfc817599a926d5945de68c6e1d477b332e42df 100644 (file)
@@ -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" ) {
index 99d51a80cacb0ca20cde0d8cdca49c534b086a41..d8fa020c8591d9902dd95ee262ff844adf767196 100644 (file)
@@ -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 ) {
index b94faf37b200a612ac16626ed0cb3b53c7531fd0..3fb2917b2b4945bb31f067eeac34527b71edaaeb 100644 (file)
@@ -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();
 
index 23d43606f1d7cf8628bfd457d0ae9c89c1a771cc..735b0e1891a96fa7186eb90c6a1003761e5aa4a4 100644 (file)
@@ -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" ) {
index 23116fa0d1ada5a87b97f0ee4ec9524e87e2f18f..15446bd8b901f396f2800184964a3cf3858c3380 100644 (file)
@@ -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 );