Re: URLQuery / FormData

On Mon, Sep 9, 2013 at 11:31 PM, Jonas Sicking <jonas@sicking.cc> wrote:
> obj.get(name)
>
> returning the first value.
>
> obj.getAll(name) or obj.getMulti(name)
>
> returning an array.

The problem with this is that then get and delete are no longer
describing similar kinds of operations. get only operates on the first
matching value. delete operates on all matching values. set would
under your proposal operate on the first value and destroy the rest.
Or would it take an array of values as well?

The mismatch between get/delete seems wrong and makes the API hard to
understand. That's why I proposed the change.


> Ddestructuring doesn't really help here since it produces parsing
> errors in downlevel clients and has to live in separate <script>s.

The future is longer than the past.


> I can live with names other than 'set' if that is the controversial
> bit. I don't understand why there's all this resistance to creating an
> API which is compatible with existing JS APIs though? The DOM going
> its own way and using a "not invented here" approach has always seemed
> like a bad thing to me.

I don't understand what you mean here.


> As far as I can tell it should be possible to make this object fully
> compatible with a Map.

It seems fundamentally incompatible with a Map. E.g. a Map does not
support checkboxes.


-- 
http://annevankesteren.nl/

Received on Monday, 9 September 2013 23:15:52 UTC