Adam Barth wrote:
On Fri, Sep 17, 2010 at 10:27 AM, Adam Barth <w...@adambarth.com> wrote:
On Thu, Sep 16, 2010 at 3:25 PM, Darin Fisher <da...@chromium.org> wrote:
On Thu, Sep 16, 2010 at 6:31 AM, Julian Reschke <julian.resc...@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
might I suggest naming it URI or IRI, and the addition of some or all of
the following methods:
bool isAbsolute();
URI defrag();
URI toAbsolute();
URI resolveReference(in URI reference);
the following methods exposed to handle complicated URIs:
u = new URI('http://ex.org/a/b/c/d/../.././egg#s/../x');
u.isAbsolute(); -> boolean
u.defrag(); ->
'http://ex.org/a/b/c/d/../.././egg'
u.toAbsolute(); -> 'http://ex.org/a/b/egg'
and to resolve relative URIs + URI References:
u = new URI('http://ex.org/a/b/c/d');
u.resolveReference('../.././n?x=y'); -> 'http://ex.org/a/n?x=y'
ps: I'll happily implement this interface Javascript whenever as I've
already got something similar: http://github.com/webr3/URI
Best,
Nathan