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

Re: [whatwg] [URL] DOM API Feedback

From: Anne van Kesteren <annevk@annevk.nl>
Date: Wed, 14 Nov 2012 10:54:26 -0800
Message-ID: <CADnb78izUBfDvZQ_0ELn6jVjj7sq3UyjTiDVTXyEpWEDFpCe4Q@mail.gmail.com>
To: Adam Barth <w3c@adambarth.com>
Cc: whatwg <whatwg@whatwg.org>, Alex Russell <slightlyoff@google.com>
On Thu, Nov 8, 2012 at 5:58 PM, Adam Barth <w3c@adambarth.com> wrote:
> On Thu, Nov 8, 2012 at 6:22 AM, Alex Russell <slightlyoff@google.com> wrote:
>>    - "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.
>
> The notion of "the same absolute URL" is a bit slippery.  It depends
> on how well you understand various URL components (e.g., octal
> encodings of IP addesss).  We could define something, of course, but
> we'd just need to do so carefully.

Yeah, it would be useful to have some use cases and examples here to
work from. E.g. I suspect we may want to have a method at some point
that considers these equal:

http://x/?test&test2
http://x/?test2&test

even though they would always be considered strictly distinct
currently (and some servers reportedly rely on this distinction).


> Yes, the http://url.spec.whatwg.org/#urlquery interface lets you get
> at parsed URL parameters.  I don't think there's currently a way to
> turn them into form data objects, but that would make sense.
>
> We might also want to add a bulk setter that takes a Dictionary.

Concrete suggestions for URLQuery are very much welcome. For behavior too.

get()/getAll() are clear.

set() not so much:
  "?x&y&x=5&y"
  set("x","1")

what happens? Or with set("x", [1,2])? And set("x", [1,2,3]? Idea:

  "?x=1&y&y"
  "?x=1&y&x=2&y"
  "?x=1&y&x=2&y&x3"

So set() replaces values in order, removes parameters for which no
values are set, and adds parameters if there are no existing
parameters.

I think that calls for add() as well, which simply appends a
parameter, irrespective of what is there now.

Allowing new FormData(URLQuery) makes sense to me.


> That's covered in step 1 of
> <http://url.spec.whatwg.org/#constructors>.  If there's no explicit
> base, the URL is resolved relative to about:blank.  To me, that seems
> better that implicitly using the document's base URL.  You can always
> supply the document's base URL from document.baseURI if you want.

Yeah, that was my thinking too.


-- 
http://annevankesteren.nl/
Received on Wednesday, 14 November 2012 19:18:54 GMT

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