W3C home > Mailing lists > Public > whatwg@whatwg.org > September 2012

Re: [whatwg] New URL Standard

From: Robin Berjon <robin@w3.org>
Date: Tue, 25 Sep 2012 13:48:11 +0200
Message-ID: <506199FB.4000402@w3.org>
To: Glenn Maynard <glenn@zewt.org>
Cc: whatwg <whatwg@whatwg.org>
On 25/09/2012 01:07 , Glenn Maynard wrote:
> On Mon, Sep 24, 2012 at 12:30 PM, Tab Atkins Jr. <jackalmage@gmail.com>wrote:
>> I suggest just making it a map from String->[String].  You probably
>> want a little bit of magic - if the setter receives an array, replace
>> the current value with it; anything else, stringify then wrap in an
>> array and replace the current value.  The getter should return an
>> empty array for non-existing params.  You should be able to set .query
>> itself with an object, which empties out the map and then runs the
>> setter over all the items.  Bam, every single methods is now obsolete.
> When should this API guarantee that it round-trips URLs cleanly (aside from
> quoting differences)?  For example, maintaining order in "a=1&b=2&a=1", and
> representing things like "a=1&b" (no '=') and "a&&b" (no key at all).

And round-tripping using ; as the separator instead of &. I mention this 
because I've seen actual production code (more than once) that relied on 
this. I have no idea how common it is though. I'm guessing not too much, 
but probably some since it was in HTML 4.01:


Of course another option is to just not parse that into key-value pairs 
in the first place.

> By the way, it would also be nice for the query part of this API to be
> usable in isolation.


Robin Berjon - http://berjon.com/ - @robinberjon
Received on Tuesday, 25 September 2012 11:55:02 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:59:45 UTC