[whatwg] New URL Standard

Silvia Pfeiffer silviapfeiffer1 at gmail.com
Tue Sep 25 05:20:02 PDT 2012

On Tue, Sep 25, 2012 at 9:48 PM, Robin Berjon <robin at w3.org> wrote:
> On 25/09/2012 01:07 , Glenn Maynard wrote:
>> On Mon, Sep 24, 2012 at 12:30 PM, Tab Atkins Jr.
>> <jackalmage at 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:
>     http://www.w3.org/TR/html401/appendix/notes.html#h-B.2.2
> Of course another option is to just not parse that into key-value pairs in
> the first place.

I have also seen key-value pairs separated both by "&" and by ";", but
not in real life in quite some time. See also the discussion here:
[1]. For media fragment URIs we chose to only recommend use of "&" [2]
(see section 51. " "&" is the only primary separator for name-value
pairs, but some server-side languages also treat ";" as a separator.


[1] https://discussion.dreamhost.com/thread-134179.html
[2] http://www.w3.org/TR/media-frags/

More information about the whatwg mailing list