X-Git-Url: http://git.asbjorn.it/?a=blobdiff_plain;f=src%2Fattributes.js;h=3e4c5f21629776a5f4e5bdf33699790c8761483b;hb=726fda08bea7bbd72d73be4563aba855c63966fe;hp=004c6b30ca0bd1dfa4f02cc6cc05502acd904742;hpb=21e15219be8e04b3fe25d05a65abfaef96830b9f;p=jquery.git diff --git a/src/attributes.js b/src/attributes.js index 004c6b3..3e4c5f2 100644 --- a/src/attributes.js +++ b/src/attributes.js @@ -43,7 +43,7 @@ jQuery.fn.extend({ var className = " " + elem.className + " "; for ( var c = 0, cl = classNames.length; c < cl; c++ ) { if ( className.indexOf( " " + classNames[c] + " " ) < 0 ) { - elem.className += " " + classNames[c]; + elem.className = jQuery.trim( elem.className + " " + classNames[c] ); } } } @@ -74,7 +74,7 @@ jQuery.fn.extend({ for ( var c = 0, cl = classNames.length; c < cl; c++ ) { className = className.replace(" " + classNames[c] + " ", " "); } - elem.className = className.substring(1, className.length - 1); + elem.className = jQuery.trim( className ); } else { elem.className = ""; @@ -281,7 +281,7 @@ jQuery.extend({ if ( set ) { // We can't allow the type property to be changed (since it causes problems in IE) if ( name === "type" && rtype.test( elem.nodeName ) && elem.parentNode ) { - throw "type property can't be changed"; + jQuery.error( "type property can't be changed" ); } elem[ name ] = value; @@ -330,7 +330,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 ); } });