diff options
author | aFarkas <info@corrupt-system.de> | 2011-04-23 11:29:07 +0200 |
---|---|---|
committer | timmywil <tim.willison@thisismedium.com> | 2011-04-25 12:41:12 -0400 |
commit | 9559b1a294af42d4c12d20b8af7a8422903b0a73 (patch) | |
tree | 3738cdb4aec35bc28e38443bed2bb4eb23629c82 /src | |
parent | 02ad0aa3b6d3c28494465539976211b6a89cb1e0 (diff) | |
download | jquery-9559b1a294af42d4c12d20b8af7a8422903b0a73.tar.gz jquery-9559b1a294af42d4c12d20b8af7a8422903b0a73.zip |
dealing with boolean content attribute
Diffstat (limited to 'src')
-rw-r--r-- | src/attributes.js | 19 |
1 files changed, 4 insertions, 15 deletions
diff --git a/src/attributes.js b/src/attributes.js index c2557633f..990884484 100644 --- a/src/attributes.js +++ b/src/attributes.js @@ -311,7 +311,7 @@ jQuery.extend({ if ( value !== undefined ) { - if ( value === null ) { + if ( value === null || value === false ) { jQuery.removeAttr( elem, name ); return undefined; @@ -319,6 +319,9 @@ jQuery.extend({ return ret; } else { + if( value === true ){ + value = name; + } elem.setAttribute( name, "" + value ); return value; } @@ -478,20 +481,6 @@ if ( !jQuery.support.getSetAttribute ) { }); } -// Remove certain attrs if set to false -jQuery.each([ "selected", "checked", "readOnly", "disabled" ], function( i, name ) { - jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], { - set: function( elem, value ) { - if ( value === true ) { - elem.setAttribute( name, name ); - return value; - } else if ( value === false ) { - jQuery.removeAttr( elem, name ); - return value; - } - } - }); -}); // Some attributes require a special call on IE if ( !jQuery.support.hrefNormalized ) { |