Skip to content

fix: method is case insensitive #13639

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

Merged
merged 2 commits into from
Oct 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/khaki-mirrors-warn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'svelte': patch
---

fix: `method` attribute is case insensitive
6 changes: 3 additions & 3 deletions packages/svelte/elements.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -892,7 +892,7 @@ export interface HTMLButtonAttributes extends HTMLAttributes<HTMLButtonElement>
| 'text/plain'
| undefined
| null;
formmethod?: 'dialog' | 'get' | 'post' | undefined | null;
formmethod?: 'dialog' | 'get' | 'post' | 'DIALOG' | 'GET' | 'POST' | undefined | null;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we also include capitalized variations? I believe they are also valid?

Suggested change
formmethod?: 'dialog' | 'get' | 'post' | 'DIALOG' | 'GET' | 'POST' | undefined | null;
formmethod?: 'dialog' | 'get' | 'post' | 'DIALOG' | 'GET' | 'POST' | 'Dialog' | 'Get' | 'Post' | undefined | null;

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are they that common though? Searching through github and it seems to only be lowercase or all uppercase that I can find.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it is common practice to see lower case only or upper case only, and I wouldn't mind even having only one version for consistency. Otherwise auto-completion will look like a mess if we respect the case-insensitivity
Capture d’écran 2024-10-17 à 11 21 14

formnovalidate?: boolean | undefined | null;
formtarget?: string | undefined | null;
name?: string | undefined | null;
Expand Down Expand Up @@ -963,7 +963,7 @@ export interface HTMLFormAttributes extends HTMLAttributes<HTMLFormElement> {
| 'text/plain'
| undefined
| null;
method?: 'dialog' | 'get' | 'post' | undefined | null;
method?: 'dialog' | 'get' | 'post' | 'DIALOG' | 'GET' | 'POST' | undefined | null;
name?: string | undefined | null;
novalidate?: boolean | undefined | null;
target?: string | undefined | null;
Expand Down Expand Up @@ -1064,7 +1064,7 @@ export interface HTMLInputAttributes extends HTMLAttributes<HTMLInputElement> {
| 'text/plain'
| undefined
| null;
formmethod?: 'dialog' | 'get' | 'post' | undefined | null;
formmethod?: 'dialog' | 'get' | 'post' | 'DIALOG' | 'GET' | 'POST' | undefined | null;
formnovalidate?: boolean | undefined | null;
formtarget?: string | undefined | null;
height?: number | string | undefined | null;
Expand Down