"var" declarations shadowing properties from Window.prototype

Boris Zbarsky bzbarsky at MIT.EDU
Sun Aug 12 09:40:32 PDT 2012


On 8/10/12 9:00 PM, Jonas Sicking wrote:
> One potential solution that I think we should keep in mind is to
> declare that WebIDL properties *on global objects* doesn't go on the
> prototype chain, but rather on the global objects themselves.
...
> It also has the advantage that Chrome already does this

Chrome does this for some properties (attributes) but not others 
(operations).

I assume you just meant to do this for attributes?  Those are the only 
cases in which var would call setters, obviously.

The var shadowing issue is an issue for operations too, of course, but 
it sounds like that's being solved on the ES side.

I can live with putting attributes directly on the global.  If we ever 
add an attribute to EventTarget that will be a little weird because 
hooking the getter or setter on EventTarget.prototype will affect all 
event targets _except_ the global, but that's life.

-Boris


More information about the es-discuss mailing list