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

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

Received on Sunday, 12 August 2012 02:25:17 UTC