W3C home > Mailing lists > Public > public-webapps@w3.org > July to September 2010

Re: A URL API

From: Maciej Stachowiak <mjs@apple.com>
Date: Fri, 17 Sep 2010 11:51:27 -0700
Cc: Darin Fisher <darin@chromium.org>, Julian Reschke <julian.reschke@gmx.de>, Anne van Kesteren <annevk@opera.com>, Boris Zbarsky <bzbarsky@mit.edu>, WebApps WG <public-webapps@w3.org>
Message-id: <7AFF6B86-93A7-4B67-863B-042AB39C3B91@apple.com>
To: Adam Barth <w3c@adambarth.com>

On Sep 17, 2010, at 11:36 AM, Adam Barth wrote:

> On Fri, Sep 17, 2010 at 11:16 AM, Darin Fisher <darin@chromium.org> wrote:
>> On Fri, Sep 17, 2010 at 11:05 AM, Adam Barth <w3c@adambarth.com> wrote:
>>> On Fri, Sep 17, 2010 at 10:27 AM, Adam Barth <w3c@adambarth.com> wrote:
>>>> On Thu, Sep 16, 2010 at 3:25 PM, Darin Fisher <darin@chromium.org>
>>>> wrote:
>>>>> On Thu, Sep 16, 2010 at 6:31 AM, Julian Reschke <julian.reschke@gmx.de>
>>>>> wrote:
>>>>>> That sounds good to me. In general I think it would be great if there
>>>>>> were
>>>>>> standard APIs for URI/IRI construction, parsing and resolution...
>>>>> 
>>>>> Yes, that sounds pretty good to me too.
>>>> 
>>>> This has annoyed me for a while too.  I'll write up a spec.
>>> 
>>> Here's a sketch:
>>> 
>>> https://docs.google.com/document/edit?id=1r_VTFKApVOaNIkocrg0z-t7lZgzisTuGTXkdzAk4gLU&hl=en
>> 
>> Nice!  Is there any implicit unescaping done when reading those members?
>>  I'd hope for the answer to be "no" :-)
> 
> That's a good question.  I'd expect them to just be textual segments
> of the URL so you could reconstruct the URL by concatenating them.

That would be different behavior than what Location and HTMLAnchorElement do; they unescape various componenents. Is the benefit worth the divergence?

As a side note, an out-of-document HTMLAnchorElement already provides most of the functionality of this interface. Things it can't do:
- Resolve a relative URL against no base at all (probably not very useful since the interface can only represent an absolute URL).
- Resolve against an arbitrary base (maybe you could do it awkwardly using <base> tag tricks).
- Read or write the lastPathComponent or origin without further parsing (should origin really be writable? That's kind of weird...)
- Read search parameters conveniently without parsing.

It might be nice to provide the parts of this that make sense on HTMLAnchorElement and Location, then see if a new interface really pulls its weight.

Regards,
Maciej
Received on Friday, 17 September 2010 18:52:01 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 18:49:40 GMT