Conversation
source
Outdated
| button</span>, then throw a <code>TypeError</code>.</p></li> | ||
|
|
||
| <li><p>If <var>submitter</var>'s <span>form owner</span> is not this <code>form</code> element, | ||
| then throw a <code>TypeError</code>.</p></li> |
There was a problem hiding this comment.
"NotFoundError" might be suitable? It's used for TextTrack-TextTrackCue ownership check.
There was a problem hiding this comment.
TypeError is nicer if we ever want to abstract this into IDL.
There was a problem hiding this comment.
I don't think we could feasibly put this into the IDL type system... I'm reasonably convinced by the symmetry with the existing ownership check. I'll switch.
Yes, I'll make Blink implementation and WPT. |
Specification issue: whatwg/html#4187 Specification PR: whatwg/html#4597
|
Here is a test PR: web-platform-tests/wpt#16743 |
| <li><p>Otherwise, set <var>submitter</var> to this <code>form</code> element.</p></li> | ||
|
|
||
| <li><p><span data-x="concept-form-submit">Submit</span> this <code>form</code> element, from | ||
| <var>submitter</var>.</p></li> |
There was a problem hiding this comment.
I guess we somehow know that reentrancy is not a problem here? Does it rely on the protections added for formdata?
There was a problem hiding this comment.
Hmm. I guess this does open up the possibility of
form.onsubmit = () => { form.requestSubmit(); }
form.requestSubmit();We could add a flag to protect against that. I guess we should do so, for symmetry with reset(). Good catch.
Ping @tkent-google to check my logic, and also update the tests.
There was a problem hiding this comment.
We should have the reentrancy check in form submission algorithm, not in requestSubmit()
click() of a submit button already has a reentrancy issue.
form.onsubmit = () => {
form.querySelector('[type=submit]').click();
}When a submit button owned by form is clicked, submit event is dispatched, and click() invokes another form submission.
Chrome, Safari, and Firefox already have a reentrancy check for this pattern, and the form submission invoked by click() is aborted.
On the other hand, form.submit() in submit event handler should be allowed for compatibility.
WebKit/Blink implementation is something like:
<form>has in-submit-event flag, initially false.- It should be set to true before firing
submitevent, and reset to false after it. - Add "If the submitted from() method flag is not set and in-submit-event flag is true, then return." before step 6 of form submission algorithm.
There was a problem hiding this comment.
Thank you for catching that deeper problem. Do you think this flag might be mergeable with the "constructing entry list" flag?
Either way, we should fix that missing check in a separate PR, and rebase this PR on top of it. I am heading to sleep now, but maybe you could work on a spec and tests PR for it? Or I can do it tomorrow.
|
This is ready for another look, rebased on top of #4621. |
Specification issue: whatwg/html#4187 Specification PR: whatwg/html#4597
|
Heads-up @whatwg/documentation |
…), a=testonly Automatic update from web-platform-tests html: Add a test for form.requestSubmit() Specification issue: whatwg/html#4187 Specification PR: whatwg/html#4597 -- wp5At-commits: 1de2d96f75cdc7a920b74a8f406262f16531ef0f wpt-pr: 16743
…), a=testonly Automatic update from web-platform-tests html: Add a test for form.requestSubmit() Specification issue: whatwg/html#4187 Specification PR: whatwg/html#4597 -- wp5At-commits: 1de2d96f75cdc7a920b74a8f406262f16531ef0f wpt-pr: 16743
Specification issue: whatwg/html#4187 Specification PR: whatwg/html#4597
…), a=testonly Automatic update from web-platform-tests html: Add a test for form.requestSubmit() Specification issue: whatwg/html#4187 Specification PR: whatwg/html#4597 -- wp5At-commits: 1de2d96f75cdc7a920b74a8f406262f16531ef0f wpt-pr: 16743 UltraBlame original commit: d9fee4b7ddd070aaf762769226681d22b8473f86
…), a=testonly Automatic update from web-platform-tests html: Add a test for form.requestSubmit() Specification issue: whatwg/html#4187 Specification PR: whatwg/html#4597 -- wp5At-commits: 1de2d96f75cdc7a920b74a8f406262f16531ef0f wpt-pr: 16743 UltraBlame original commit: d9fee4b7ddd070aaf762769226681d22b8473f86
…), a=testonly Automatic update from web-platform-tests html: Add a test for form.requestSubmit() Specification issue: whatwg/html#4187 Specification PR: whatwg/html#4597 -- wp5At-commits: 1de2d96f75cdc7a920b74a8f406262f16531ef0f wpt-pr: 16743 UltraBlame original commit: d9fee4b7ddd070aaf762769226681d22b8473f86
…), a=testonly Automatic update from web-platform-tests html: Add a test for form.requestSubmit() Specification issue: whatwg/html#4187 Specification PR: whatwg/html#4597 -- wp5At-commits: 1de2d96f75cdc7a920b74a8f406262f16531ef0f wpt-pr: 16743
Closes #4187.
(See WHATWG Working Mode: Changes for more details.)
/cc @manucorporat and @muan as web developers who were interested in this and helped shape the feature.
Things for reviewers to consider:
/acknowledgements.html ( diff )
/forms.html ( diff )