-
Notifications
You must be signed in to change notification settings - Fork 436
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Form Link Submissions: Don't remove
<form>
until submission is comp…
…lete When an `<a>` element annotated with `[data-turbo-method]` is clicked, Turbo Drive creates, appends, submits, and removes a `<form>` element behind the scenes. Unfortunately, prior to this commit, the `<form>` element is submitted then removed synchronously and immediately. This means that by the time the `submit` events (and resulting `turbo:before-fetch-request` and `turbo:submit-start` events) bubble up through the document, the `<form>` element is already disconnected. In its absence, the `document.documentElement` serves as the event's target. This commit changes that process to defer the elements removal until _after_ it dispatches a `turbo:submit-end` event. The result is that the element is present throughout all the events, and is accessible through `event.target`.
- Loading branch information
1 parent
c4e0aba
commit 24672bf
Showing
4 changed files
with
23 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
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