Re: "var" declarations shadowing properties from Window.prototype

On Sat, Aug 11, 2012 at 6:46 PM, Cameron McCormack <cam@mcc.id.au> wrote:

> Brendan Eich:
>
>  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?
>>
>
> OK.  So one thing that I think has been pointed out is that moving
> properties for operations on to window makes it harder to monkeypatch
> addEventListener and friends.  We *could*, if we thought it was important,
> have the properties on window forward on to the ones from the prototype.
>

Can we leave EventTarget's methods on the proto chain and only move the
ones on the Window interface itself?  Unlike Window, EventTarget isn't
changing very much.

- Kyle

Received on Sunday, 12 August 2012 01:51:49 UTC