fix: input name overriding form method and action checks - #8471
Conversation
🦋 Changeset detectedLatest commit: b665068 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Conduitry
left a comment
There was a problem hiding this comment.
form.getAttribute('method') will not normalize the method name like form.method will. If someone has method="POST", the code here will not catch that. I don't know whether that would just be a matter of lowercasing the attribute, or stripping whitespace, or what.
Separately, this would (I think) also be susceptible to the extremely contrived situation of an input element name getAttribute. Similar to #7599, we should probably be using HTMLFormData.prototype here.
Good catch. Just found that out myself while trying to get the tests to pass.
I've tested and it does seem to correctly ignore input elements named "method". But I'll change it anyways for consistency
|
EDIT: Whoops. I understand how Added the same fix for an outstanding |
fixes #8467
Replaces
form.methodwithform.getAttribute('method')to avoid collisions with<input name="method">in the same form.Please don't delete this checklist! Before submitting the PR, please make sure you do the following:
Tests
pnpm testand lint the project withpnpm lintandpnpm checkChangesets
pnpm changesetand following the prompts. Changesets that add features should beminorand those that fix bugs should bepatch. Please prefix changeset messages withfeat:,fix:, orchore:.