X-Git-Url: http://git.asbjorn.it/?a=blobdiff_plain;f=src%2Fattributes.js;h=aca9e055dbdf1e113ca5d798230fb103cd7130c2;hb=266facc08a2e1c8cb5a7a60de304da47657f2227;hp=b22acba03ec72902cae1f7f1109d45723c478c6c;hpb=e76ba32cebc26108e15b2e0e03c5152624c1bad9;p=jquery.git diff --git a/src/attributes.js b/src/attributes.js index b22acba..aca9e05 100644 --- a/src/attributes.js +++ b/src/attributes.js @@ -9,7 +9,7 @@ var rclass = /[\n\t]/g, jQuery.fn.extend({ attr: function( name, value ) { - return access( this, name, value, true, jQuery.attr ); + return jQuery.access( this, name, value, true, jQuery.attr ); }, removeAttr: function( name, fn ) { @@ -40,12 +40,13 @@ jQuery.fn.extend({ elem.className = value; } else { - var className = " " + 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 ) { - elem.className += " " + classNames[c]; + setClass += " " + classNames[c]; } } + elem.className = jQuery.trim( setClass ); } } } @@ -330,7 +331,7 @@ jQuery.extend({ } // elem is actually elem.style ... set the style - // Using attr for specific style information is now deprecated. Use style insead. + // Using attr for specific style information is now deprecated. Use style instead. return jQuery.style( elem, name, value ); } });