From 0d8b247cab2f91e118d0b734028ce827e09a71f7 Mon Sep 17 00:00:00 2001 From: John Firebaugh Date: Tue, 12 Apr 2011 16:48:22 -0400 Subject: [PATCH] Accessing the 'type' property on VML elements fails on IE. Fixes #7071. --- src/event.js | 4 ++-- test/index.html | 5 +++++ test/unit/event.js | 3 +++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/event.js b/src/event.js index d6b116d2e..316a7fee1 100644 --- a/src/event.js +++ b/src/event.js @@ -800,7 +800,7 @@ if ( !jQuery.support.changeBubbles ) { beforedeactivate: testChange, click: function( e ) { - var elem = e.target, type = elem.type; + var elem = e.target, type = jQuery.nodeName( elem, "input" ) ? elem.type : ""; if ( type === "radio" || type === "checkbox" || elem.nodeName.toLowerCase() === "select" ) { testChange.call( this, e ); @@ -810,7 +810,7 @@ if ( !jQuery.support.changeBubbles ) { // Change has to be called before submit // Keydown will be called before keypress, which is used in submit-event delegation keydown: function( e ) { - var elem = e.target, type = elem.type; + var elem = e.target, type = jQuery.nodeName( elem, "input" ) ? elem.type : ""; if ( (e.keyCode === 13 && elem.nodeName.toLowerCase() !== "textarea") || (e.keyCode === 32 && (type === "checkbox" || type === "radio")) || diff --git a/test/index.html b/test/index.html index a10655089..bf7dc7989 100644 --- a/test/index.html +++ b/test/index.html @@ -45,6 +45,10 @@ + + + + @@ -147,6 +151,7 @@ test element + Float test. diff --git a/test/unit/event.js b/test/unit/event.js index b46ef9ebb..491396f93 100644 --- a/test/unit/event.js +++ b/test/unit/event.js @@ -776,6 +776,9 @@ test("trigger() shortcuts", function() { // manually clean up detached elements elem.remove(); + + // test that special handlers do not blow up with VML elements (#7071) + jQuery("#oval").click().keydown(); }); test("trigger() bubbling", function() {