X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=src%2Fattributes.js;h=147c353f4219a14cce5a9da3674818fef583b18f;hb=ea507b3e998126ae1f94f4fd1618994d645c9cc8;hp=dd6a3e7abe641b387aaa0077bdc30387373acb7d;hpb=97d468fbf0f840f52c91855b0bc8db0ed6ac403c;p=jquery.git diff --git a/src/attributes.js b/src/attributes.js index dd6a3e7..147c353 100644 --- a/src/attributes.js +++ b/src/attributes.js @@ -164,7 +164,7 @@ jQuery.fn.extend({ var option = options[ i ]; // Don't return options that are disabled or in a disabled optgroup - if ( option.selected && (jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null ) && + if ( option.selected && (jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null) && (!option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" )) ) { // Get the specific value for the option @@ -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.