W3C home > Mailing lists > Public > whatwg@whatwg.org > March 2014

[whatwg] Making URLSearchParams set() `value` argument optional

From: David Håsäther <hasather@gmail.com>
Date: Wed, 12 Mar 2014 11:04:25 +0100
Message-ID: <CAMPaTMeQ=_GPEiWxQ5htN=zxkmBJ8sQwn4QyWOXhMX5WvPxqbA@mail.gmail.com>
To: whatwg <whatwg@whatwg.org>
I would like to propose making the `value` argument optional for
URLSearchParams set()[1]. This would work as set("name", ""), but
would not output the equals sign, leading to nicer URLs.


set("name", "") -> "?name="
set("name") -> "?name"

Anne van Kesteren pointed out[2] that this is different from the
application/x-www-form-urlencoded serialization on which it currently
relies on. I'm not sure if that has any implications.

[1] http://url.spec.whatwg.org/#dom-urlsearchparams-set
[2] https://twitter.com/annevk/status/443576248166391808

David Håsäther
Received on Wednesday, 12 March 2014 10:05:41 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 17:00:17 UTC