W3C home > Mailing lists > Public > public-script-coord@w3.org > July to September 2012

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

From: Brendan Eich <brendan@mozilla.com>
Date: Sat, 11 Aug 2012 19:24:44 -0700
Message-ID: <502713EC.6070802@mozilla.com>
To: Cameron McCormack <cam@mcc.id.au>
CC: Boris Zbarsky <bzbarsky@mit.edu>, public-script-coord@w3.org, es-discuss@mozilla.org
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

This archive was generated by hypermail 2.3.1 : Wednesday, 8 May 2013 19:30:06 UTC