[whatwg] [URL] DOM API Feedback

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
"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

Anyhow, I like this. Nice work!

Received on Thursday, 8 November 2012 14:23:59 UTC