W3C home > Mailing lists > Public > public-webapps@w3.org > July to September 2010

Re: A URL API

From: Devdatta Akhawe <dev.akhawe@gmail.com>
Date: Tue, 21 Sep 2010 00:51:34 -0700
Message-ID: <AANLkTinGOpTamomonVwiNutr_tSvAgn4KpCfhk9jXtTA@mail.gmail.com>
To: Ojan Vafai <ojan@chromium.org>
Cc: Adam Barth <w3c@adambarth.com>, Darin Fisher <darin@chromium.org>, Garrett Smith <dhtmlkitchen@gmail.com>, Julian Reschke <julian.reschke@gmx.de>, WebApps WG <public-webapps@w3.org>
On 21 September 2010 00:47, Ojan Vafai <ojan@chromium.org> wrote:
> How about setParameter(name, value...) that takes var_args number of values?
> Alternately, it could take either a DOMString or an Array<DOMString> for the
> value. I prefer the var_args.

What happens when I do
setParameter('x','a','b','c');

and now want to add another - I will have to do weird things like
getting the parameter via getAllParameter and then append to the array
and function.call or something like that

doesn't look very nice according to me - I like the separation into 2
APIs because I think that makes the common case of single parameter
values clean and robust


cheers
devdatta


> Also, getParameterByName and getAllParametersByName seem unnecessarily
> wordy. How about getParameter/getParameterAll to match
> querySelector/querySelectorAll? Putting "All" at the end is admittedly
> awkward, but this is the uncommon case, so I'm OK with it for making the
> common case less wordy.
> Ojan
> On Tue, Sep 21, 2010 at 4:56 PM, Adam Barth <w3c@adambarth.com> wrote:
>>
>> Ok.  I'm sold on having an API for constructing query parameters.
>> Thoughts on what it should look like?  Here's what jQuery does:
>>
>> http://api.jquery.com/jQuery.get/
>>
>> Essentially, you supply a JSON object containing the parameters.  They
>> also have some magical syntax for specifying multiple instances of the
>> same parameter name.  I like the easy of supplying a JSON object, but
>> I'm not in love with the magical syntax.  An alternative is to use two
>> APIs, like we current have for reading the parameter values.
>>
>> Adam
>>
>>
>> On Mon, Sep 20, 2010 at 11:47 PM, Devdatta Akhawe <dev.akhawe@gmail.com>
>> wrote:
>> > or any webservice that likes to have lots of query parameters - Google
>> > Search for example.
>> >
>> > In general, why would you not want a robust way to make complicated
>> > queries - those who are making simple queries and prefer simple one
>> > liners can continue using it.
>> >
>> >
>> > On 20 September 2010 23:42, Darin Fisher <darin@chromium.org> wrote:
>> >> On Mon, Sep 20, 2010 at 11:02 AM, Garrett Smith
>> >> <dhtmlkitchen@gmail.com>
>> >> wrote:
>> >>>
>> >>> On 9/20/10, Julian Reschke <julian.reschke@gmx.de> wrote:
>> >>> > On 20.09.2010 18:56, Garrett Smith wrote:
>> >>> [...]
>> >>> >> Requests that don't have lot of parameters are often simple
>> >>> >> one-liners:
>> >>> >>
>> >>> >> url = "/getShipping/?zip=" + zip + "&pid=" + pid;
>> >>> >
>> >>> > That's exactly the kind of code that will fail once "pid" and "zip"
>> >>> > contain things you don't expecz.
>> >>> >
>> >>> >> What XHRs have complicated URL with a lot of query parameters?
>> >>> >
>> >>> > What XHRs?
>> >>> >
>> >>> IOW, what are the cases where an XHR instance wants to use a lot o
>> >>> query
>> >>> params?
>> >>>
>> >>
>> >> Probably when speaking to a HTTP server designed to take input from an
>> >> HTML
>> >> form.
>> >> -Darin
>> >>
>> >
>>
>
>
Received on Tuesday, 21 September 2010 07:52:29 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 18:49:40 GMT