mirror of
https://github.com/withastro/astro.git
synced 2025-03-10 23:01:26 -05:00
fixes property shadowing for form.attributes (#13313)
Co-authored-by: ematipico <602478+ematipico@users.noreply.github.com>
This commit is contained in:
parent
2cdeaea64c
commit
9e7c71d19c
3 changed files with 7 additions and 2 deletions
5
.changeset/purple-jokes-pay.md
Normal file
5
.changeset/purple-jokes-pay.md
Normal file
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
'astro': patch
|
||||
---
|
||||
|
||||
Fixes an issue where a form field named "attributes" shadows the form.attributes property.
|
|
@ -12,5 +12,6 @@ export const prerender = false;
|
|||
<input type="hidden" name="name" value="Testing" />
|
||||
{postShowThrow ? <input type="hidden" name="throw" value="true" /> : ''}
|
||||
<input type="submit" value="Submit" id="submit" />
|
||||
<input type="text" name="attributes" />
|
||||
</form>
|
||||
</Layout>
|
||||
|
|
|
@ -397,8 +397,7 @@ async function transition(
|
|||
//
|
||||
// Note: getNamedItem can return null in real life, even if TypeScript doesn't think so, hence
|
||||
// the ?.
|
||||
init.body =
|
||||
form?.attributes.getNamedItem('enctype')?.value === 'application/x-www-form-urlencoded'
|
||||
init.body = (from !== undefined && Reflect.get(HTMLFormElement.prototype, "attributes", form).getNamedItem('enctype')?.value === 'application/x-www-form-urlencoded')
|
||||
? new URLSearchParams(preparationEvent.formData as any)
|
||||
: preparationEvent.formData;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue