From a5cf257a8a240f96f1ec255599fa1d1190f51ff5 Mon Sep 17 00:00:00 2001 From: timmywil Date: Mon, 16 May 2011 10:17:50 -0400 Subject: [PATCH] Use getAttributeNode for ^on attributes in IE6/7 to avoid anonymous function wrapper. Fixes #9298. --- src/attributes.js | 2 +- test/unit/attributes.js | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/attributes.js b/src/attributes.js index 0eac08a6..a4cf7695 100644 --- a/src/attributes.js +++ b/src/attributes.js @@ -7,7 +7,7 @@ var rclass = /[\n\t\r]/g, rfocusable = /^(?:button|input|object|select|textarea)$/i, rclickable = /^a(?:rea)?$/i, rboolean = /^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i, - rinvalidChar = /\:/, + rinvalidChar = /\:|^on/, formHook, boolHook; jQuery.fn.extend({ diff --git a/test/unit/attributes.js b/test/unit/attributes.js index 8f2eb723..9ecf2360 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(39); + expect(40); equals( jQuery("#text1").attr("type"), "text", "Check for type attribute" ); equals( jQuery("#radio1").attr("type"), "radio", "Check for type attribute" ); @@ -119,7 +119,10 @@ test("attr(String)", function() { 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" ); + 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." ); }); if ( !isLocal ) {