Re: URL API

On Mon, Jul 8, 2013 at 11:38 AM, Anne van Kesteren <annevk@annevk.nl> wrote:
> Posting this here just in case people have different ideas on URL APIs
> now from a couple of months ago:
>
>   http://url.spec.whatwg.org/#api
>   http://url.spec.whatwg.org/#urlquery
>
> 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 suggest a plain array.  Don't get too fancy until there's call.

Re: Domenic, the fact that `pathname.split('/')` returns an array
guaranteed to have an empty first element (because pathname always
starts with '/') is annoying.  I don't think there are any other
issues with splitting.  Joining, though, is fraught with peril, as
your path segments may have gained a literal / in their value, which
when joined changes the meaning.  If we allow you to set the pathname
via an array, we can auto-escape it for you.

So, Anne, I suggest letting pathname be set to an array, which does
the joining and escaping for you automatically.

> Another thing that would be nice if a URLQuery object could be
> populated based on a custom object or a Map. However, how we should
> extract the key/value pairs out of those in a way that's consistent
> across APIs is not really established.

I started a thread on this recently in es-discuss, because I want the
same for anything with [MapClass].  Python uses .update().

~TJ

Received on Monday, 8 July 2013 19:53:43 UTC