X-Git-Url: http://git.asbjorn.it/?a=blobdiff_plain;f=src%2Fattributes.js;h=be221afa3d687527df9698061db8e808b0fb4436;hb=fb48ae8e6cca25fd29ef2b1eb23e9efa7b0eef7c;hp=4393a9fdbc38a449f279d752a83e218db8ab3efb;hpb=b5b3c73db3e4e615e504cd0af08ff6842b104542;p=jquery.git diff --git a/src/attributes.js b/src/attributes.js index 4393a9f..be221af 100644 --- a/src/attributes.js +++ b/src/attributes.js @@ -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 );