Skip to content

Commit

Permalink
Move the value attrHook to the main attrHooks object to save bytes
Browse files Browse the repository at this point in the history
  • Loading branch information
timmywil committed May 26, 2011
1 parent 9d4033d commit 1d202c6
Showing 1 changed file with 19 additions and 20 deletions.
39 changes: 19 additions & 20 deletions src/attributes.js
Expand Up @@ -414,6 +414,25 @@ jQuery.extend({
0 : 0 :
undefined; undefined;
} }
},
// Use the value property for back compat
// Use the formHook for button elements in IE6/7 (#1954)
value: {
get: function( elem, name ) {
if ( formHook && jQuery.nodeName( elem, "button" ) ) {
return formHook.get( elem, name );
}
return name in elem ?
elem.value :
null;
},
set: function( elem, value, name ) {
if ( formHook && jQuery.nodeName( elem, "button" ) ) {
return formHook.set( elem, value, name );
}
// Does not return so that setAttribute is also used
elem.value = value;
}
} }
}, },


Expand Down Expand Up @@ -497,26 +516,6 @@ boolHook = {
} }
}; };


// Use the value property for back compat
// Use the formHook for button elements in IE6/7 (#1954)
jQuery.attrHooks.value = {
get: function( elem, name ) {
if ( formHook && jQuery.nodeName( elem, "button" ) ) {
return formHook.get( elem, name );
}
return name in elem ?
elem.value :
null;
},
set: function( elem, value, name ) {
if ( formHook && jQuery.nodeName( elem, "button" ) ) {
return formHook.set( elem, value, name );
}
// Does not return so that setAttribute is also used
elem.value = value;
}
};

// IE6/7 do not support getting/setting some attributes with get/setAttribute // IE6/7 do not support getting/setting some attributes with get/setAttribute
if ( !jQuery.support.getSetAttribute ) { if ( !jQuery.support.getSetAttribute ) {


Expand Down

0 comments on commit 1d202c6

Please sign in to comment.