- From: TAMURA, Kent <notifications@github.com>
- Date: Thu, 31 Oct 2019 17:34:30 -0700
- To: whatwg/xhr <xhr@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
- Message-ID: <whatwg/xhr/issues/262@github.com>
Context: https://github.com/whatwg/html/issues/3195 Context: https://github.com/whatwg/xhr/issues/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 https://github.com/whatwg/html/issues/3195#issuecomment-540927844 ---- 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. -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/whatwg/xhr/issues/262
Received on Friday, 1 November 2019 00:34:33 UTC