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


From: Adam Barth <w3c@adambarth.com>
Date: Wed, 22 Sep 2010 00:48:32 -0700
Message-ID: <AANLkTingpXBiFQ-+mSdr8H1B-46W72b8JsJtMmesniNp@mail.gmail.com>
To: Ojan Vafai <ojan@chromium.org>
Cc: "Tab Atkins Jr." <jackalmage@gmail.com>, Devdatta Akhawe <dev.akhawe@gmail.com>, Darin Fisher <darin@chromium.org>, Garrett Smith <dhtmlkitchen@gmail.com>, Julian Reschke <julian.reschke@gmx.de>, WebApps WG <public-webapps@w3.org>
Thanks for all your input.

1) I've renamed getParameterByName to getParameter and
getAllParametersByName to getParameterAll.
2) I've added two flavors of appendParameter.  The first flavor takes
a DOMString for a value and appends a single parameter.  The second
flavor takes an array of DOMStrings and appends one parameter for each
array.  This seemed better than using a variable number of arguments.
3) I've added a clearParameter method.

Defining these methods required some low-level URL manipulation that's
not actually defined anywhere (AFAIK), so I've added a reference to my
work-in-progress draft about parsing and canonicalizing URLs.


On Tue, Sep 21, 2010 at 3:40 PM, Ojan Vafai <ojan@chromium.org> wrote:
> appendParameter/clearParameter seems fine to me.
> On Wed, Sep 22, 2010 at 2:53 AM, Tab Atkins Jr. <jackalmage@gmail.com>
> wrote:
>> On Mon, Sep 20, 2010 at 11: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.
>> jQuery's syntax isn't magical - the example they give using the query
>> param name of 'choices[]' is doing that because PHP requires a [] at
>> the end of the query param name to signal it that you want multiple
>> values.  It's opaque, though - you could just as easily have left off
>> the '[]' and it would have worked the same.
>> The switch is just whether you pass an array or a string (maybe they
>> support numbers too?).
>> I recommend the method be called append*, so you can use it both for
>> first sets and later additions (this is particularly useful if you're
>> just looping through some data).  This obviously would then need a
>> clear functionality as well.
>> ~TJ
Received on Wednesday, 22 September 2010 08:14:25 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 18:13:11 UTC