Re: URLQuery / FormData

On Mon, Sep 9, 2013 at 7:30 AM, Anne van Kesteren <annevk@annevk.nl> wrote:

> 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
>

Excellent! I was concerned that my explanation at the last tc-39 meeting
wasn't sufficiently convincing enough :)


* 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.
>

This makes sense, and append() covers the most common case anyway.


> 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.
>

Agreed (to both)

Rick

Received on Monday, 9 September 2013 17:36:23 UTC