"var" declarations shadowing properties from Window.prototype

Boris Zbarsky bzbarsky at MIT.EDU
Sun Aug 12 09:58:22 PDT 2012


On 8/11/12 9:16 PM, Brendan Eich wrote:
> As bz and others point out, the object detection w/ var pattern can
> arise for operations, e.g. for requestAnimationFrame, using the same
>
>    var requestAnimationFrame = window.mozRequestAnimationFrame || ... ||
> window.requestAnimationFrame;
>
> pattern. So WebIDL operations (JS methods) on the global would be
> promoted to "own" too. They'd be configurable, if I recall correctly,
> and either writable or replaceable. Do I have that right?

This is unnecessary if we stick with the current var wording in 5.1.

If this _is_ done, that will mean hooking 
EventTarget.prototype.addEventListener won't hook adds on the global, 
which is a bit weird.

-Boris



More information about the es-discuss mailing list