Skip to content

Commit

Permalink
Retrieve the class attribute on a form in IE6/7. Fixes 9286.
Browse files Browse the repository at this point in the history
  • Loading branch information
timmywil committed May 14, 2011
1 parent cf70249 commit 6171e0a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/attributes.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down
5 changes: 4 additions & 1 deletion test/unit/attributes.js
Original file line number Diff line number Diff line change
Expand Up @@ -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" );
Expand Down Expand Up @@ -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 ) {
Expand Down

0 comments on commit 6171e0a

Please sign in to comment.