diff options
author | timmywil <timmywillisn@gmail.com> | 2012-03-05 12:54:44 -0500 |
---|---|---|
committer | timmywil <timmywillisn@gmail.com> | 2012-03-05 12:54:44 -0500 |
commit | d3320462df1253196e61b2daadc3cdfe1b4c3771 (patch) | |
tree | 99fcae31613ebb67d74919489f9c848cb580ed1e /src | |
parent | 8013163a36be2e954344ad689e95a5773d61f1e9 (diff) | |
download | jquery-d3320462df1253196e61b2daadc3cdfe1b4c3771.tar.gz jquery-d3320462df1253196e61b2daadc3cdfe1b4c3771.zip |
Do not set boolean attributes to empty string on removal. Fixes #10870. +0 bytes compressed
Diffstat (limited to 'src')
-rw-r--r-- | src/attributes.js | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/attributes.js b/src/attributes.js index 88ce4df23..df7ed028e 100644 --- a/src/attributes.js +++ b/src/attributes.js @@ -352,7 +352,7 @@ jQuery.extend({ }, removeAttr: function( elem, value ) { - var propName, attrNames, name, l, + var propName, attrNames, name, l, isBool, i = 0; if ( value && elem.nodeType === 1 ) { @@ -364,13 +364,17 @@ jQuery.extend({ if ( name ) { propName = jQuery.propFix[ name ] || name; + isBool = rboolean.test( name ); // See #9699 for explanation of this approach (setting first, then removal) - jQuery.attr( elem, name, "" ); + // Do not do this for boolean attributes (see #10870) + if ( !isBool ) { + jQuery.attr( elem, name, "" ); + } elem.removeAttribute( getSetAttribute ? name : propName ); // Set corresponding property to false for boolean attributes - if ( rboolean.test( name ) && propName in elem ) { + if ( isBool && propName in elem ) { elem[ propName ] = false; } } |