W3C home > Mailing lists > Public > public-script-coord@w3.org > July to September 2013

Re: URL API

From: Robin Berjon <robin@w3.org>
Date: Mon, 08 Jul 2013 22:02:56 +0200
Message-ID: <51DB1AF0.5060007@w3.org>
To: Domenic Denicola <domenic@domenicdenicola.com>
CC: Anne van Kesteren <annevk@annevk.nl>, "public-script-coord@w3.org" <public-script-coord@w3.org>
On 08/07/2013 21:16 , Domenic Denicola wrote:
>> One thing that's still a bit unclear is how to expose path
>> segments. We could expose the segments as array, we could expose a
>> special segments object so you can change the URL that way, or
>> something else. Suggestions welcome.
>
> I would be tempted to just leave it out and make people do the work
> manually of manipulating `pathname`, since I can't think of a great
> answer. Or are there potential footguns we want to avoid, e.g. if
> people naively did `url.pathname.split("/")` or `url.pathname =
> mySegments.join("/")` they wouldn't get what you expect? I guess
> there are some encoding issues...

People will na´vely split and join on "/" while forgetting about the 
leading "/". They'll also forget about %-escaping, which they should 
except that if setting the string directly you can't tell if a "/" in it 
was intended as a separator or not.

An abstraction would certainly be helpful here.

-- 
Robin Berjon - http://berjon.com/ - @robinberjon
Received on Monday, 8 July 2013 20:03:09 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:37:50 UTC