Follow w3c standard for setting the common boolean attributes to the same name(selected, checked, readOnly, and disabled)

1.7/enhancement_8685
timmywil 2011-04-19 17:48:07 -04:00
parent 8d2d94cfba
commit 103d325887
1 changed files with 4 additions and 1 deletions

View File

@ -473,7 +473,10 @@ if ( !jQuery.support.getSetAttribute ) {
jQuery.each([ "selected", "checked", "readOnly", "disabled" ], function( i, name ) {
jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], {
set: function( elem, value ) {
if ( value === false ) {
if ( value === true ) {
elem.setAttribute( name, name );
return value;
} else if ( value === false ) {
jQuery.removeAttr( elem, name );
return value;
}