"var" declarations shadowing properties from Window.prototype

Brendan Eich brendan at mozilla.com
Sat Aug 11 19:24:44 PDT 2012


Just to clarify:

Brendan Eich wrote:
> Agreed. Jonas and I are talking about an exception for the global 
> object. It's the one on the scope chain. Well, other DOM objects are 
> on scope chains of attribute-expressed event handlers. But such event 
> handlers do not have any problem with var aliasing or shadowing a 
> scope-object's properties (own or inherited).

... because event-handler attributes express function bodies, and 
function activations have their own (non-object) scope in which var 
binds, whatever outer object-based scope chain such DOM attribute event 
handlers have. No pigeon hole problem as with the global scope/object.

/be


More information about the es-discuss mailing list