[whatwg] URL: URLQuery

Glenn Maynard glenn at zewt.org
Sat Oct 13 08:53:06 PDT 2012

On Fri, Oct 12, 2012 at 8:01 PM, Boris Zbarsky <bzbarsky at mit.edu> wrote:

>  As you might have noticed, JS started adding things like Map in part
> because the native dictionary-like access has one significant problem: it
> looks up the prototype chain.

You mean, people putting extra properties on things like Object.prototype
or DOMStringMap.prototype, and breaking code doing for(a in {})?  I don't
find that to be a problem: that's nuts, so I don't do it.

It probably wouldn't hurt to actually prevent this from happening in the
first place, though, which I think is what you're suggesting below.

Unless the suggestion is that Object.getPrototypeOf(query.values) === null?

That, or making the prototype immutable, as if Object.freeze was called on

On Sat, Oct 13, 2012 at 3:24 AM, Anne van Kesteren <annevk at annevk.nl> wrote:

> Where did .values come from?

To avoid putting object-like access and member methods on the same

I just want to make sure that if we're not using the native getter/setter
syntax, we're doing it for the right reasons.  The argument for "never
exposing any APIs that require proxies to implement in JavaScript" seems
weak.  "APIs shouldn't both act like dictionaries and have other methods on
the same object" is a good idea (and not a new one), but that's a smaller

Maybe it's not worth having two interfaces (URLQuery and whatever
query.values is called) to avoid that--I don't know if that adds a lot of
complexity--but that's a separate question.

(And you reversed get()/set() right?)


> It was a more limited version of this interface (the problem with
> length was more about what would happen if you would add such a
> member):

Don't do that--if an object acts like a dictionary, it should have no
members of its own.

> I don't know about JavaScript Map as to whether that would be reusable
> in some way. We have some special requirements from last thread:
> * Keys can have more than one value.
> * Keys are ordered behind the scenes.
> If it is reusable that would be great. I guess Web IDL then needs to
> be updated somehow to give us some hooks.

FWIW, map apparently doesn't yet have iteration (according to
which I assume is wanted here.

Where would extra WebIDL hooks be needed--isn't this just a regular WebIDL
interface to line up with?

Glenn Maynard

More information about the whatwg mailing list