mirror of
https://github.com/jquery/jquery.git
synced 2026-02-06 14:14:56 -05:00
Handle changing form attributes correctly when there is a child element with the same name. Fixes #4299
This commit is contained in:
committed by
John Resig
parent
d3dc2d1234
commit
841f9ff7a1
@@ -218,7 +218,13 @@ jQuery.extend({
|
||||
if ( name == "type" && /(button|input)/i.test(elem.nodeName) && elem.parentNode ) {
|
||||
throw "type property can't be changed";
|
||||
}
|
||||
elem[ name ] = value;
|
||||
// browsers index elements by id/name on forms, give priority to attributes.
|
||||
if( jQuery.nodeName( elem, "form" ) ) {
|
||||
// convert the value to a string (all browsers do this but IE) see #1070
|
||||
elem.setAttribute( name, "" + value );
|
||||
} else {
|
||||
elem[ name ] = value;
|
||||
}
|
||||
}
|
||||
|
||||
// browsers index elements by id/name on forms, give priority to attributes.
|
||||
|
||||
Reference in New Issue
Block a user