Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Fix #11649. Preserve oldIE submit flag when cloning, closes gh-772.
- Loading branch information
Showing
3 changed files
with
37 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1062,6 +1062,41 @@ test("trigger(type, [data], [fn])", function() { | ||
form.remove(); | ||
}); | ||
|
||
test( "submit event bubbles on copied forms (#11649)", function(){ | ||
expect( 3 ); | ||
|
||
var $formByClone, $formByHTML, | ||
$testForm = jQuery("#testForm"), | ||
$fixture = jQuery("#qunit-fixture"), | ||
$wrapperDiv = jQuery("<div/>").appendTo( $fixture ); | ||
|
||
function noSubmit( e ) { | ||
e.preventDefault(); | ||
} | ||
function delegatedSubmit() { | ||
ok( true, "Make sure submit event bubbles up." ); | ||
return false; | ||
} | ||
|
||
// Attach a delegated submit handler to the parent element | ||
$fixture.on( "submit", "form", delegatedSubmit ); | ||
|
||
// Trigger form submission to introduce the _submit_attached property | ||
$testForm.on( "submit", noSubmit ).find("input[name=sub1]").click(); | ||
|
||
// Copy the form via .clone() and .html() | ||
$formByClone = $testForm.clone( true, true ).removeAttr("id"); | ||
$formByHTML = jQuery( $fixture.html() ).filter("#testForm").removeAttr("id"); | ||
$wrapperDiv.append( $formByClone, $formByHTML ); | ||
|
||
// Check submit bubbling on the copied forms | ||
$wrapperDiv.find("form").on( "submit", noSubmit ).find("input[name=sub1]").click(); | ||
|
||
// Clean up | ||
$wrapperDiv.remove(); | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
dmethvin
Member
|
||
$fixture.off( "submit", "form", delegatedSubmit ); | ||
}); | ||
|
||
test("trigger(eventObject, [data], [fn])", function() { | ||
expect(28); | ||
|
||
Need to add one more clean-up item here as well: