Skip to content

Commit 81c778b

Browse files
committed
Fix #10208. Check for button as well as input when performing the #7071 VML crash workaround for IE special-events submit code.
1 parent 8e8fa6d commit 81c778b

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

src/event.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -702,8 +702,9 @@ if ( !jQuery.support.submitBubbles ) {
702702
setup: function( data, namespaces ) {
703703
if ( !jQuery.nodeName( this, "form" ) ) {
704704
jQuery.event.add(this, "click.specialSubmit", function( e ) {
705+
// Avoid triggering error on non-existent type attribute in IE VML (#7071)
705706
var elem = e.target,
706-
type = jQuery.nodeName( elem, "input" ) ? elem.type : "";
707+
type = jQuery.nodeName( elem, "input" ) || jQuery.nodeName( elem, "button" ) ? elem.type : "";
707708

708709
if ( (type === "submit" || type === "image") && jQuery( elem ).closest("form").length ) {
709710
trigger( "submit", this, arguments );
@@ -712,7 +713,7 @@ if ( !jQuery.support.submitBubbles ) {
712713

713714
jQuery.event.add(this, "keypress.specialSubmit", function( e ) {
714715
var elem = e.target,
715-
type = jQuery.nodeName( elem, "input" ) ? elem.type : "";
716+
type = jQuery.nodeName( elem, "input" ) || jQuery.nodeName( elem, "button" ) ? elem.type : "";
716717

717718
if ( (type === "text" || type === "password") && jQuery( elem ).closest("form").length && e.keyCode === 13 ) {
718719
trigger( "submit", this, arguments );

test/unit/event.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1633,7 +1633,7 @@ test("live with change", function(){
16331633
});
16341634

16351635
test("live with submit", function() {
1636-
expect(5);
1636+
expect(7);
16371637

16381638
var count1 = 0, count2 = 0;
16391639

@@ -1659,6 +1659,10 @@ test("live with submit", function() {
16591659
equals( count1, 2, "Verify form submit." );
16601660
equals( count2, 2, "Verify body submit." );
16611661

1662+
jQuery("#testForm button[name=sub4]")[0].click();
1663+
equals( count1, 3, "Verify form submit." );
1664+
equals( count2, 3, "Verify body submit." );
1665+
16621666
jQuery("#testForm").die("submit");
16631667
jQuery("#testForm input[name=sub1]").die("click");
16641668
jQuery("body").die("submit");

0 commit comments

Comments
 (0)