aboutsummaryrefslogtreecommitdiffstats
path: root/src/attributes.js
diff options
context:
space:
mode:
authortimmywil <tim.willison@thisismedium.com>2011-03-25 21:13:25 -0400
committertimmywil <tim.willison@thisismedium.com>2011-04-03 19:13:40 -0400
commite0900a686d3c80054afd0ebe4c8908a8b5568444 (patch)
tree40742a6152971260e8f0b0d399e34ef327c22288 /src/attributes.js
parent3892df207d7a4a3babf5017a309263cceff48b65 (diff)
downloadjquery-e0900a686d3c80054afd0ebe4c8908a8b5568444.tar.gz
jquery-e0900a686d3c80054afd0ebe4c8908a8b5568444.zip
Fix issue where non-existant attributes on forms in IE6/7 were throwing errors
Diffstat (limited to 'src/attributes.js')
-rw-r--r--src/attributes.js12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/attributes.js b/src/attributes.js
index dd4844020..b68b3edf8 100644
--- a/src/attributes.js
+++ b/src/attributes.js
@@ -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 );
}