diff --git a/src/attributes.js b/src/attributes.js index a4cf7695..6353e636 100644 --- a/src/attributes.js +++ b/src/attributes.js @@ -516,7 +516,7 @@ if ( !jQuery.support.getSetAttribute ) { jQuery.attrFix = jQuery.propFix; // Use this for any attribute on a form in IE6/7 - formHook = jQuery.attrHooks.name = jQuery.valHooks.button = { + formHook = jQuery.attrHooks.name = jQuery.attrHooks.title = jQuery.valHooks.button = { get: function( elem, name ) { var ret; ret = elem.getAttributeNode( name ); diff --git a/test/unit/attributes.js b/test/unit/attributes.js index 9ecf2360..549efcab 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(40); + expect(42); equals( jQuery("#text1").attr("type"), "text", "Check for type attribute" ); equals( jQuery("#radio1").attr("type"), "radio", "Check for type attribute" ); @@ -115,14 +115,16 @@ test("attr(String)", function() { equals( jQuery("#table").attr("test:attrib"), undefined, "Retrieving a non-existent attribute on a table with a colon does not throw an error." ); equals( jQuery("#table").attr("test:attrib", "foobar").attr("test:attrib"), "foobar", "Setting an attribute on a table with a colon does not throw an error." ); - ok( jQuery("
").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("
").appendTo("#qunit-fixture"); equal( $form.attr("class"), "something", "Retrieve the class attribute on a form." ); var $a = jQuery("Click").appendTo("#qunit-fixture"); equal( $a.attr("onclick"), "something()", "Retrieve ^on attribute without anonymous function wrapper." ); + + ok( jQuery("
").attr("doesntexist") === undefined, "Make sure undefined is returned when no attribute is found." ); + ok( jQuery("
").attr("title") === undefined, "Make sure undefined is returned when no attribute is found." ); + equal( jQuery("
").attr("title", "something").attr("title"), "something", "Set the title attribute." ); + ok( jQuery().attr("doesntexist") === undefined, "Make sure undefined is returned when no element is there." ); }); if ( !isLocal ) {