diff options
author | John Firebaugh <john_firebaugh@bigfix.com> | 2011-04-12 16:48:22 -0400 |
---|---|---|
committer | John Resig <jeresig@gmail.com> | 2011-04-12 16:48:22 -0400 |
commit | 0d8b247cab2f91e118d0b734028ce827e09a71f7 (patch) | |
tree | 81663e8bfa60d2fcf7e8f5f9cb96ab21ab40316f | |
parent | 3418f323876043db63a2da9f653e51d5458647fa (diff) | |
download | jquery-0d8b247cab2f91e118d0b734028ce827e09a71f7.tar.gz jquery-0d8b247cab2f91e118d0b734028ce827e09a71f7.zip |
Accessing the 'type' property on VML elements fails on IE. Fixes #7071.
-rw-r--r-- | src/event.js | 4 | ||||
-rw-r--r-- | test/index.html | 5 | ||||
-rw-r--r-- | 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 @@ <script src="unit/effects.js"></script> <script src="unit/offset.js"></script> <script src="unit/dimensions.js"></script> + + <!-- For testing http://bugs.jquery.com/ticket/7071 --> + <xml:namespace ns="urn:schemas-microsoft-com:vml" prefix="v" /> + <style>v\:oval { behavior:url(#default#VML); display:inline-block; }</style> </head> <body id="body"> @@ -147,6 +151,7 @@ <span id="test.foo[5]bar" class="test.foo[5]bar"></span> <foo_bar id="foobar">test element</foo_bar> + <v:oval id="oval" style="width:100pt;height:75pt;" fillcolor="red"> </v:oval> </form> <b id="floatTest">Float test.</b> <iframe id="iframe" name="iframe"></iframe> 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() { |