X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=src%2Fattributes.js;h=147c353f4219a14cce5a9da3674818fef583b18f;hb=6bc30425f6d3c9c1eaddacc5d08bb29a4a0636ca;hp=cb9f2cf5e073e997d6c04a86e9400cfa8b4eedcc;hpb=d558e9eb6f44783bb06666617c758408daf53e3d;p=jquery.git diff --git a/src/attributes.js b/src/attributes.js index cb9f2cf..147c353 100644 --- a/src/attributes.js +++ b/src/attributes.js @@ -215,6 +215,10 @@ jQuery.fn.extend({ val = ""; } else if ( typeof val === "number" ) { val += ""; + } else if ( jQuery.isArray(val) ) { + val = jQuery.map(val, function (value) { + return value == null ? "" : value + ""; + }); } if ( jQuery.isArray(val) && rradiocheck.test( this.type ) ) { @@ -295,7 +299,14 @@ jQuery.extend({ jQuery.error( "type property can't be changed" ); } - elem[ name ] = value; + if ( value === null ) { + if ( elem.nodeType === 1 ) { + elem.removeAttribute( name ); + } + + } else { + elem[ name ] = value; + } } // browsers index elements by id/name on forms, give priority to attributes.