aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortimmywil <tim.willison@thisismedium.com>2011-05-14 12:07:40 -0400
committertimmywil <tim.willison@thisismedium.com>2011-05-14 12:07:40 -0400
commit6171e0a923c4775d0b5e560900f397c33b6341d9 (patch)
tree7d2f41d8b6a68f7a9af0686828f57044fcf0a108
parentcf702496ee28830f3488ed3f1c3940cfbb2dfa8f (diff)
downloadjquery-6171e0a923c4775d0b5e560900f397c33b6341d9.tar.gz
jquery-6171e0a923c4775d0b5e560900f397c33b6341d9.zip
Retrieve the class attribute on a form in IE6/7. Fixes 9286.
-rw-r--r--src/attributes.js4
-rw-r--r--test/unit/attributes.js5
2 files changed, 7 insertions, 2 deletions
diff --git a/src/attributes.js b/src/attributes.js
index af1660fa6..0eac08a6f 100644
--- a/src/attributes.js
+++ b/src/attributes.js
@@ -322,7 +322,9 @@ jQuery.extend({
hooks = boolHook;
// Use formHook for forms and if the name contains certain characters
- } else if ( formHook && (jQuery.nodeName( elem, "form" ) || rinvalidChar.test( name )) ) {
+ } else if ( formHook && name !== "className" &&
+ (jQuery.nodeName( elem, "form" ) || rinvalidChar.test( name )) ) {
+
hooks = formHook;
}
}
diff --git a/test/unit/attributes.js b/test/unit/attributes.js
index 79730026a..8f2eb7237 100644
--- a/test/unit/attributes.js
+++ b/test/unit/attributes.js
@@ -40,7 +40,7 @@ test("jQuery.attrFix/jQuery.propFix integrity test", function() {
});
test("attr(String)", function() {
- expect(38);
+ expect(39);
equals( jQuery("#text1").attr("type"), "text", "Check for type attribute" );
equals( jQuery("#radio1").attr("type"), "radio", "Check for type attribute" );
@@ -117,6 +117,9 @@ test("attr(String)", function() {
ok( jQuery("<div/>").attr("doesntexist") === undefined, "Make sure undefined is returned when no attribute is found." );
ok( jQuery().attr("doesntexist") === undefined, "Make sure undefined is returned when no element is there." );
+
+ var $form = jQuery("<form class='something'></form>").appendTo("#qunit-fixture");
+ equal( $form.attr("class"), "something", "Retrieve the class attribute on a form" );
});
if ( !isLocal ) {