Context: whatwg/html#3195
Context: #202
FormData should have ability to add an entry for a submitter button when it appends entries for a <form>.
We have multiple options of how to specify submitter. See five comments since whatwg/html#3195 (comment)
A) constructor(optional (HTMLFormElement or record<USVString, FormDataEntryValue>) formOrMap, optional HTMLElement? submitter = null)
Idiomatic.
B) constructor(optional (HTMLElement or record<...>) formOrSubmitterOrMap)
HTMLElement represents a form or a submitter.
C) constructor(optional (HTMLFormElement or FormDataInit) formOrDict)
dictionary FormDataInit {
HTMLFormElement form;
HTMLElement? submitter;
record<...> map;
}
The content of the dictionary is idiomatic.
Need to wrap a record with a dictionary.
Extensible. It's easy to add new members to the dictionary in the future.
D) constructor(optional (HTMLFormElement or FormDataInit or URLSearchParams) init)
dictionary FormDataInit {
required HTMLFormElement form;
HTMLElement? submitter = null;
}
FormData doesn't support record<> directly. Developers have to write new FormData(new URLSearchParams(map)).
E) constructor(optional HTMLFormElement form, optional HTMLElement? submitter = null)
FormData append(record<USVString, FormDataEntryValue> map);
Developers have to write new FormData().append(map).
F) (no changes on the constructor)
FormData append(HTMLFormElement form, optional HTMLElement? submitter = null);
FormData append(record<USVString, FormDataEntryValue> map);
Developers have to write let fd = new FormData().append(form, submitter); if they want to collect entries including an entry for the submitter.
Context: whatwg/html#3195
Context: #202
FormData should have ability to add an entry for a submitter button when it appends entries for a <form>.
We have multiple options of how to specify submitter. See five comments since whatwg/html#3195 (comment)
A)
constructor(optional (HTMLFormElement or record<USVString, FormDataEntryValue>) formOrMap, optional HTMLElement? submitter = null)Idiomatic.
B)
constructor(optional (HTMLElement or record<...>) formOrSubmitterOrMap)HTMLElementrepresents a form or a submitter.C)
constructor(optional (HTMLFormElement or FormDataInit) formOrDict)The content of the dictionary is idiomatic.
Need to wrap a record with a dictionary.
Extensible. It's easy to add new members to the dictionary in the future.
D)
constructor(optional (HTMLFormElement or FormDataInit or URLSearchParams) init)FormDatadoesn't supportrecord<>directly. Developers have to writenew FormData(new URLSearchParams(map)).E)
constructor(optional HTMLFormElement form, optional HTMLElement? submitter = null)FormData append(record<USVString, FormDataEntryValue> map);Developers have to write
new FormData().append(map).F) (no changes on the constructor)
Developers have to write
let fd = new FormData().append(form, submitter);if they want to collect entries including an entry for the submitter.