Add attribute name to paramaters for hooks
This commit is contained in:
parent
03da4c7ca7
commit
11c97bb066
1 changed files with 21 additions and 23 deletions
|
@ -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,27 +428,25 @@ 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, name ) {
|
||||||
set: function( elem, value ) {
|
// 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 );
|
if ( ret ) {
|
||||||
if ( ret ) {
|
ret.nodeValue = value;
|
||||||
ret.nodeValue = value;
|
} else {
|
||||||
} else {
|
elem.setAttribute( name, value );
|
||||||
elem.setAttribute( name, value );
|
|
||||||
}
|
|
||||||
return value;
|
|
||||||
}
|
}
|
||||||
};
|
return value;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue