aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorOleg Gaidarenko <markelog@gmail.com>2015-12-22 14:16:55 +0300
committerOleg Gaidarenko <markelog@gmail.com>2015-12-22 14:16:55 +0300
commitb87e93bdc92dfcb96fcd5ef26e528cbfaa42c8bf (patch)
tree6469e7f809cc4de7217be35e15f87f58a7b189fe /src
parent83391859bda90f630bf02a5e04d82e9f1babeb1f (diff)
downloadjquery-b87e93bdc92dfcb96fcd5ef26e528cbfaa42c8bf.tar.gz
jquery-b87e93bdc92dfcb96fcd5ef26e528cbfaa42c8bf.zip
Revert "Attributes: do not set properties to false when removing booleans"
This reverts commit 5c086c3782459307c44397549fef15a87c8b90c4.
Diffstat (limited to 'src')
-rw-r--r--src/attributes/attr.js19
1 files changed, 18 insertions, 1 deletions
diff --git a/src/attributes/attr.js b/src/attributes/attr.js
index 22945c255..125e094d9 100644
--- a/src/attributes/attr.js
+++ b/src/attributes/attr.js
@@ -92,12 +92,29 @@ jQuery.extend( {
},
removeAttr: function( elem, value ) {
- var name,
+ var name, propName,
i = 0,
attrNames = value && value.match( rnotwhite );
if ( attrNames && elem.nodeType === 1 ) {
while ( ( name = attrNames[ i++ ] ) ) {
+ propName = jQuery.propFix[ name ] || name;
+
+ // Boolean attributes get special treatment (#10870)
+ if ( jQuery.expr.match.bool.test( name ) ) {
+
+ // Set corresponding property to false
+ if ( getSetInput || !ruseDefault.test( name ) ) {
+ elem[ propName ] = false;
+
+ // Support: IE<9
+ // Also clear defaultChecked/defaultSelected (if appropriate)
+ } else {
+ elem[ jQuery.camelCase( "default-" + name ) ] =
+ elem[ propName ] = false;
+ }
+ }
+
elem.removeAttribute( name );
}
}