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

Re: [whatwg] New URL Standard

From: Silvia Pfeiffer <silviapfeiffer1@gmail.com>
Date: Tue, 25 Sep 2012 22:20:02 +1000
Message-ID: <CAHp8n2=v2S6+w_MEZUY4vitz+w3oCQx6-R-G+-uDMW9S-eYJaw@mail.gmail.com>
To: Robin Berjon <robin@w3.org>
Cc: whatwg <whatwg@whatwg.org>, Glenn Maynard <glenn@zewt.org>
On Tue, Sep 25, 2012 at 9:48 PM, Robin Berjon <robin@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@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/
Received on Tuesday, 25 September 2012 12:25:08 UTC

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