This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 26913 - Should FormData.append()/set() be aligned with form data set construction?
Summary: Should FormData.append()/set() be aligned with form data set construction?
Status: RESOLVED WORKSFORME
Alias: None
Product: WHATWG
Classification: Unclassified
Component: Fetch (show other bugs)
Version: unspecified
Hardware: PC Windows NT
: P2 normal
Target Milestone: Unsorted
Assignee: Anne
QA Contact: sideshowbarker+fetchspec
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-09-26 18:01 UTC by sof
Modified: 2014-10-13 15:30 UTC (History)
5 users (show)

See Also:


Attachments

Description sof 2014-09-26 18:01:10 UTC
The "create an entry" steps for FormData, https://xhr.spec.whatwg.org/#create-an-entry allows empty names to be supplied. 

Form submission does not consider elements with an empty name, https://html.spec.whatwg.org/#constructing-form-data-set (excepting image buttons)

Should the former be consistent with the latter wrt empty names?
Comment 1 Anne 2014-09-26 20:13:00 UTC
Jonas, Ian, Domenic, Erik, opinions?
Comment 2 Domenic Denicola 2014-09-26 23:50:57 UTC
If this is the only area they are misaligned, then aligning them seems reasonable. If they are more generally misaligned though then I'd say leave it.

Another approach: FormData is being used in Fetch not only as a serialization format but as a deserialization format. What happens if you deserialize `=value1&=value2` into a FormData? Does that create empty names? If so then letting the user create them via the API is a must.
Comment 3 Anne 2014-09-27 09:13:56 UTC
I don't know, multipart/form-data isn't really well defined. You can have a name that's empty, but whether that is then discarded or used is unclear.
Comment 4 sof 2014-09-30 19:19:52 UTC
To provide a bit of implementation context, Blink (and WebKit) currently ignores empty names upon FormData.append(). Presto, Gecko and Trident do allow empties, at least at the script API level.

Blink is considering alignment (https://codereview.chromium.org/609733004/ ); knowing if the spec'ed behavior is intentional, would be useful.

fwiw, i can't imagine a use for empty names, but like for URLSearchParams query names, it's arguably too late to impose restrictions.
Comment 5 Anne 2014-10-13 15:30:16 UTC
Yeah, I think we should just allow this at this point. Sorry for not having more carefully considered this from the start. I wish the format had been better defined :-(