- From: Tab Atkins Jr. <jackalmage@gmail.com>
- Date: Mon, 24 Sep 2012 10:30:06 -0700
- To: Anne van Kesteren <annevk@annevk.nl>
- Cc: Alexandre Morgaut <Alexandre.Morgaut@4d.com>, whatwg <whatwg@whatwg.org>
On Mon, Sep 24, 2012 at 2:34 AM, Anne van Kesteren <annevk@annevk.nl> wrote: > I have been thinking about introducing a .query attribute that would > return a special interface for this purpose, but what the right API > should be seems somewhat tricky. Adam and Erik came up with a solution > that introduces eight new methods (see > http://dvcs.w3.org/hg/url/raw-file/tip/Overview.html#url ) but I hope > we can find something more elegant. (Unless we are stuck with their > solution for some reason, but I believe that is not the case.) Yeah, that interface is pretty unfriendly. I suggest just making it a map from String->[String]. You probably want a little bit of magic - if the setter receives an array, replace the current value with it; anything else, stringify then wrap in an array and replace the current value. The getter should return an empty array for non-existing params. You should be able to set .query itself with an object, which empties out the map and then runs the setter over all the items. Bam, every single methods is now obsolete. ~TJ
Received on Monday, 24 September 2012 17:31:43 UTC