]> source.dussan.org Git - jquery.git/commitdiff
Accessing the 'type' property on VML elements fails on IE. Fixes #7071.
authorJohn Firebaugh <john_firebaugh@bigfix.com>
Tue, 12 Apr 2011 20:48:22 +0000 (16:48 -0400)
committerJohn Resig <jeresig@gmail.com>
Tue, 12 Apr 2011 20:48:22 +0000 (16:48 -0400)
src/event.js
test/index.html
test/unit/event.js

index d6b116d2e0a98b58c1d9cf389a63b11cd392368a..316a7fee12032c77a45d3d9517cb0588e1c80dc9 100644 (file)
@@ -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")) ||
index a106550898d860127d66ba585599370066e4f37e..bf7dc7989ef2c7d0952444c9b92acdbd530a3808 100644 (file)
        <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">
                        <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>
index b46ef9ebbcd544e0cb2afac61c8b3485e8f616ff..491396f93ccbd49c6bc03231cfd1548a740474c5 100644 (file)
@@ -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() {