"var" declarations shadowing properties from Window.prototype

Boris Zbarsky bzbarsky at MIT.EDU
Sun Aug 12 10:04:53 PDT 2012


On 8/11/12 9:48 PM, Allen Wirfs-Brock wrote:
> I see, this makes perfect sense when onload is viewed simply as a passive property.

That stops being an option once addEventListener also appears, for what 
it's worth.

> It is turning into an active side-effecting registration mechanism that conceptually clashed with function declarations.  I wonder why that was necessary.

Because event listener ordering matters, so you have to register the 
event listener when onload property is set.  Now the question is what 
that listener does: it could just take the thing it's given, or it could 
dynamically look up "onload" on the global.  At some point Gecko used to 
do the latter; it would be interesting to check why we stopped.  It's 
all in the revision history!

-Boris


More information about the es-discuss mailing list