- From: Glenn Maynard <glenn@zewt.org>
- Date: Tue, 25 Sep 2012 21:36:02 -0500
- To: Boris Zbarsky <bzbarsky@mit.edu>
- Cc: whatwg@lists.whatwg.org
On Tue, Sep 25, 2012 at 9:27 PM, Boris Zbarsky <bzbarsky@mit.edu> wrote:
> On 9/25/12 10:13 PM, Glenn Maynard wrote:
>
>> The obvious use case is constructing a URI with a given query by
>> hand, right?
>>
>> If you already have the "a=1&b=2" string, you can just assign it to
>> .search and not use the prepared-query-parameters interface at all.
>>
>
> I was thinking more like you have the arrays ["a", "b"] (hardcoded) and
> [1, 2] (provided by user).
>
You usually don't care about the resulting order in that case, right?
You'd just say something like
assert(key_names.length == user_data.length); // ["a", "b"].length == [1,
2].length
for(var i = 0; i < user_data.length; ++i)
url.query[key_names[i]] = ]user_data[i];
When do you care about being able to specifically create (or distinguish)
"a=1&b=2" vs. "b=2&a=1" (or, a bit trickier, "a=1&b=2&a=3")?
--
Glenn Maynard
Received on Wednesday, 26 September 2012 02:36:30 UTC