Fix issue where non-existant attributes on forms in IE6/7 were throwing errors
This commit is contained in:
parent
3892df207d
commit
e0900a686d
2 changed files with 12 additions and 9 deletions
|
@ -311,10 +311,11 @@ jQuery.extend({
|
|||
return undefined;
|
||||
|
||||
} else {
|
||||
|
||||
|
||||
// Check form objects in IE (multiple bugs related)
|
||||
if ( isFormObjects ) {
|
||||
elem.getAttributeNode( name ).nodeValue = value;
|
||||
// Only use nodeValue if the attribute node exists on the form
|
||||
if ( isFormObjects && (ret = elem.getAttributeNode( name )) ) {
|
||||
ret.nodeValue = value;
|
||||
} else {
|
||||
elem.setAttribute( name, value );
|
||||
}
|
||||
|
@ -330,8 +331,9 @@ jQuery.extend({
|
|||
|
||||
// Check form objects in IE (multiple bugs related)
|
||||
if ( isFormObjects ) {
|
||||
// Return undefined for empty string, which is the blank nodeValue in IE
|
||||
ret = elem.getAttributeNode( name ).nodeValue || undefined;
|
||||
// Return undefined if not specified instead of empty string
|
||||
ret = elem.getAttributeNode( name );
|
||||
return ret && ret.specified ? ret.nodeValue : undefined;
|
||||
} else {
|
||||
ret = elem.getAttribute( name );
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue