X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=src%2Fattributes.js;h=147c353f4219a14cce5a9da3674818fef583b18f;hb=ea507b3e998126ae1f94f4fd1618994d645c9cc8;hp=608b8e339eb6a024f5a86c323c15fe4b45d288fd;hpb=157a383dae5335ef1056d3818d7dd70ac81c25a7;p=jquery.git diff --git a/src/attributes.js b/src/attributes.js index 608b8e3..147c353 100644 --- a/src/attributes.js +++ b/src/attributes.js @@ -164,8 +164,9 @@ jQuery.fn.extend({ var option = options[ i ]; // Don't return options that are disabled or in a disabled optgroup - if ( option.selected && 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 value = jQuery(option).val(); @@ -214,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 ) ) { @@ -294,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. @@ -332,7 +344,7 @@ jQuery.extend({ // Ensure that missing attributes return undefined // Blackberry 4.7 returns "" from getAttribute #6938 - if ( !elem.attributes[ name ] && !elem.hasAttribute( name ) ) { + if ( !elem.attributes[ name ] && (elem.hasAttribute && !elem.hasAttribute( name )) ) { return undefined; }