[whatwg] [URL] DOM API Feedback
Anne van Kesteren
annevk at annevk.nl
Wed Nov 14 10:54:26 PST 2012
On Thu, Nov 8, 2012 at 5:58 PM, Adam Barth <w3c at adambarth.com> wrote:
> On Thu, Nov 8, 2012 at 6:22 AM, Alex Russell <slightlyoff at 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/
More information about the whatwg
mailing list