Fix submit buttons with children that get removed
If a <button> element inside a <form> has a child element which is clicked, and the <button>'s onclick handler removes the child element from the DOM, the <button>'s default event handler which submits the form is never called. If this happens, and the <button>'s onclick handler also manually submits the form via form.submit(), then the form double-submit fix made in crrev.com/c/1850358 will prevent form.submit() from submitting the form because the form.submit() is blocked until the <button> gets the DOMActivate event, which never happens if the child element is removed from the DOM before it can emit the DOMActivate event to the parent <button>. This patch will submit the form in this case by listening to the click event instead of the DOMActivate event. If the click event is additionally preventDefault()ed, this patch will not cover that case. Once we switch back to async form submission in crbug.com/1013385 then all of the cases will be covered and this patch will be reverted. Bug: 1037740 Change-Id: I04cdff451b363b5fafa26d2c58ec0aa76ed95a0f Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1983547Reviewed-by:Kent Tamura <tkent@chromium.org> Reviewed-by:
Mason Freed <masonfreed@chromium.org> Commit-Queue: Joey Arhar <jarhar@chromium.org> Cr-Commit-Position: refs/heads/master@{#728662}
Showing
Please register or sign in to comment