URLQuery / FormData

We had a discussion here once before I think about a good
representation for an ordered list of name/value pairs (i.e. allows
duplicate names). In particular this is what <form> represents and
therefore quite important.

http://url.spec.whatwg.org/#interface-urlquery has an API, but looking
over it now it's not really consistent in how get/set/delete works.

My current thinking is to update URLQuery as follows:

* get(name) -- always returns an array, with ES6 destructering this
should be fine
* append(name, value) -- always appends to the end
* delete(name) -- always removes all
* has(name) -- same as now

I'll leave out set() for now.

Since it's a list I don't think item count should be called size, but
rather length. However, maybe we don't need that for now either.

The object should also support iteration. Waiting for that to get
implemented in browsers and become more stable.


FormData can largely mirror this, but also needs to support Blob +
filename -> File so append supports an additional argument filename as
per http://xhr.spec.whatwg.org/#dom-formdata-append

Thoughts?


-- 
http://annevankesteren.nl/

Received on Monday, 9 September 2013 11:30:33 UTC