"var" declarations shadowing properties from Window.prototype

Brendan Eich brendan at mozilla.org
Sat Aug 11 12:21:58 PDT 2012

Allen Wirfs-Brock wrote:
> On Aug 10, 2012, at 11:14 PM, Brendan Eich wrote:
>>> In this case, firing the setter is perhaps what the programmer 
>>> wanted, even if it is a terrible way to accomplish that end.
>> It's not that bad if you start from the DOM level 0, especially 
>> window.onload being the same binding as function onload() {}.
> There seems to be a contradiction between what you describe above for 
> primordial and what ES1-3 said:

There was no contradiction in the old days. Writing

   function onload() {}

did not run a proto-setter to add an event listener. Rather, a load 
event fired by trying any function named by window.onload.

At some point this stopped working. Not sure when, but it's how JS + DOM 
level 0 worked in Netscape 2 when they debuted, and I believe for a long 
while after.


More information about the es-discuss mailing list