X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=src%2Fattributes.js;h=ec4841bd3f4f27d271f01a5388e8fd39ca97e2e0;hb=a2aefbf3b198620ae45d2451d21cc5bf96258a7d;hp=fd3e38acec80d174f82cbe44313a646d6ad8065b;hpb=0636dffc2481c14368464a22ffa1bd8017da2a26;p=jquery.git diff --git a/src/attributes.js b/src/attributes.js index fd3e38a..ec4841b 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.disabled && + 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(); @@ -294,7 +295,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 +340,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; }