Accessing the 'type' property on VML elements fails on IE. Fixes #7071.

This commit is contained in:
John Firebaugh 2011-04-12 16:48:22 -04:00 committed by John Resig
parent 3418f32387
commit 0d8b247cab
3 changed files with 10 additions and 2 deletions

View file

@ -800,7 +800,7 @@ if ( !jQuery.support.changeBubbles ) {
beforedeactivate: testChange, beforedeactivate: testChange,
click: function( e ) { 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" ) { if ( type === "radio" || type === "checkbox" || elem.nodeName.toLowerCase() === "select" ) {
testChange.call( this, e ); testChange.call( this, e );
@ -810,7 +810,7 @@ if ( !jQuery.support.changeBubbles ) {
// Change has to be called before submit // Change has to be called before submit
// Keydown will be called before keypress, which is used in submit-event delegation // Keydown will be called before keypress, which is used in submit-event delegation
keydown: function( e ) { 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") || if ( (e.keyCode === 13 && elem.nodeName.toLowerCase() !== "textarea") ||
(e.keyCode === 32 && (type === "checkbox" || type === "radio")) || (e.keyCode === 32 && (type === "checkbox" || type === "radio")) ||

View file

@ -45,6 +45,10 @@
<script src="unit/effects.js"></script> <script src="unit/effects.js"></script>
<script src="unit/offset.js"></script> <script src="unit/offset.js"></script>
<script src="unit/dimensions.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> </head>
<body id="body"> <body id="body">
@ -147,6 +151,7 @@
<span id="test.foo[5]bar" class="test.foo[5]bar"></span> <span id="test.foo[5]bar" class="test.foo[5]bar"></span>
<foo_bar id="foobar">test element</foo_bar> <foo_bar id="foobar">test element</foo_bar>
<v:oval id="oval" style="width:100pt;height:75pt;" fillcolor="red"> </v:oval>
</form> </form>
<b id="floatTest">Float test.</b> <b id="floatTest">Float test.</b>
<iframe id="iframe" name="iframe"></iframe> <iframe id="iframe" name="iframe"></iframe>

View file

@ -776,6 +776,9 @@ test("trigger() shortcuts", function() {
// manually clean up detached elements // manually clean up detached elements
elem.remove(); elem.remove();
// test that special handlers do not blow up with VML elements (#7071)
jQuery("#oval").click().keydown();
}); });
test("trigger() bubbling", function() { test("trigger() bubbling", function() {