WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED INVALID
265077
Submitting a form with requestSubmit() sets the submitter of the SubmitEvent object to the most recent submitter instead of the one passed, or nothing if no argument is given
https://bugs.webkit.org/show_bug.cgi?id=265077
Summary
Submitting a form with requestSubmit() sets the submitter of the SubmitEvent ...
Caleb Land
Reported
2023-11-17 21:50:06 PST
Submitting a form with requestSubmit() (with or without a submitter argument) sets the "submitter" property of the SubmitEvent to the most recently used submitter. Using the form and javascript below you can see that first clicking one of the buttons that submits via "requestSubmit" shows that the "submitter" property of the SubmitEvent is undefined. However, if you first click one of the real submit buttons and then click one of the requestSubmit buttons, the most recently clicked real submit button is put in the submitter property. <form id="form" action="/" method="post"> <button type="submit" name="submit-button" value="submit-button">Submit Button #1</button> <button type="submit" name="other-submit" value="other-submit">Other Submit Button</button> <button type="button" id="via-other">Submit via requestSubmit(otherSubmitButton)</button> <button type="button" id="via-none">Submit via requestSubmit()</button> </form> <script type="application/javascript"> document.forms[0].addEventListener("submit", function(event) { event.preventDefault() console.log(event.submitter) }) document.querySelector("#via-other").addEventListener("click", function(event) { event.preventDefault() let otherSubmitButton = document.querySelector("[name='other-submit']") document.forms[0].requestSubmit(otherSubmitButton) }) document.querySelector("#via-none").addEventListener("click", function(event) { event.preventDefault() document.forms[0].requestSubmit() }) </script> I would expect requestSubmit() to set the submitter to undefined and the requestSubmit(someOtherSubmit) to always have someOtherButton as the submitter, and this is how Chrome and Firefox behave.
Attachments
Add attachment
proposed patch, testcase, etc.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug