Add attribute name to paramaters for hooks

This commit is contained in:
timmywil 2011-03-26 00:15:25 -04:00
parent 03da4c7ca7
commit 11c97bb066

View file

@ -302,7 +302,7 @@ jQuery.extend({
// Get the appropriate hook, or the formHook // Get the appropriate hook, or the formHook
// if getSetAttribute is not supported and we have form objects in IE6/7 // if getSetAttribute is not supported and we have form objects in IE6/7
hooks = formHook && ( name === "name" || elem.nodeName === "FORM" ) ? hooks = formHook && ( name === "name" || elem.nodeName === "FORM" ) ?
formHook( name ) : jQuery.attrHooks[ name ] || formHook :
jQuery.attrHooks[ name ]; jQuery.attrHooks[ name ];
if ( value !== undefined ) { if ( value !== undefined ) {
@ -311,7 +311,7 @@ jQuery.extend({
jQuery.removeAttr( elem, name ); jQuery.removeAttr( elem, name );
return undefined; return undefined;
} else if ( hooks && "set" in hooks && notxml && (ret = hooks.set( elem, value )) !== undefined ) { } else if ( hooks && "set" in hooks && notxml && (ret = hooks.set( elem, value, name )) !== undefined ) {
return ret; return ret;
} else { } else {
@ -322,7 +322,7 @@ jQuery.extend({
} else { } else {
if ( hooks && "get" in hooks && notxml ) { if ( hooks && "get" in hooks && notxml ) {
return hooks.get( elem ); return hooks.get( elem, name );
} else { } else {
@ -428,16 +428,15 @@ if ( !jQuery.support.getSetAttribute ) {
// Use this for any attribute on a form in IE6/7 // Use this for any attribute on a form in IE6/7
// And the name attribute // And the name attribute
formHook = function( name ) { formHook = {
return jQuery.attrHooks[ name ] || { get: function( elem, name ) {
get: function( elem ) {
var ret = elem.getAttributeNode( name ); var ret = elem.getAttributeNode( name );
// Return undefined if not specified instead of empty string // Return undefined if not specified instead of empty string
return ret && ret.specified ? return ret && ret.specified ?
ret.nodeValue : ret.nodeValue :
undefined; undefined;
}, },
set: function( elem, value ) { set: function( elem, value, name ) {
// Check form objects in IE (multiple bugs related) // Check form objects in IE (multiple bugs related)
// Only use nodeValue if the attribute node exists on the form // Only use nodeValue if the attribute node exists on the form
var ret = elem.getAttributeNode( name ); var ret = elem.getAttributeNode( name );
@ -449,7 +448,6 @@ if ( !jQuery.support.getSetAttribute ) {
return value; return value;
} }
}; };
};
} }
// Remove certain attrs if set to false // Remove certain attrs if set to false