-
-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: input name overriding form method and action checks #8471
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
fixes #8467
Replaces
form.method
withform.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 test
and lint the project withpnpm lint
andpnpm check
Changesets
pnpm changeset
and following the prompts. Changesets that add features should beminor
and those that fix bugs should bepatch
. Please prefix changeset messages withfeat:
,fix:
, orchore:
.