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

[whatwg] [URL] DOM API Feedback

From: Alex Russell <slightlyoff@google.com>
Date: Thu, 8 Nov 2012 14:22:20 +0000
Message-ID: <CANr5HFVQ0e_svEE8JUqG1zNoB+ODfyN20_83qKzk3fXNi3g2jw@mail.gmail.com>
To: whatwg <whatwg@whatwg.org>
Howdy all,

Anne asked me to send feedback on the DOM API for the new URL spec (
http://url.spec.whatwg.org/#api) to this list. Here goes:

First, I love that this looks sane, like what you need most of the time,
and will plumb through to the browser's parsing algorithm without requiring
me to re-write this sort of thing (badly) every time I need it. +1 for
adding a good DOM API!

Next, nicely done on having a meaningful constructor! I do wonder if the
"url" parameter should be optional as well as the base, since you may
either want to build a URL using a URL object (to be serialized later).

Looking at what URL/URLUtils provides, I noted a couple of things I'd like
to see that I miss from
google-url<http://code.google.com/p/google-url/source/browse/trunk/src/gurl.h>(a.k.a.
"GURL", the URL library we use in Chrome):


   - GetWithEmptyPath() & GetOrigin() (despite their terrible C++ naming)
   are hugely useful for doing comparisons. I could imagine that there's some
   - "username" and "password" properties are missing
   - There aren't any provided comparison functions. I.e., there's no way
   to tell if two URL objects reference the same absolute URL, if
   one references a path in the same domain, etc.
   - Is there any attempt to parse query parameters and/or return a form
   data object from them?

Also, what's the default base URL? If I'm in a document with a base set,
are instances that don't specify one relative to the origin of the window
object from which the instance is created? I ask, because in the caes of:

    new URL("/thinger.html");

I'd expect identical calls like that to have different toString() values if
executed on foo.com and bar.com. It was unclear to me if that's the case
today.

Anyhow, I like this. Nice work!
Received on Thursday, 8 November 2012 14:23:59 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 30 January 2013 18:48:11 GMT