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

Re: variable declarations shadowing named properties on window

From: Cameron McCormack <cam@mcc.id.au>
Date: Fri, 06 Jan 2012 10:14:50 +1100
Message-ID: <4F062EEA.2040902@mcc.id.au>
To: Boris Zbarsky <bzbarsky@MIT.EDU>
CC: Travis Leithead <travis.leithead@microsoft.com>, Ojan Vafai <ojan@chromium.org>, "public-script-coord@w3.org" <public-script-coord@w3.org>, Allen Wirfs-Brock <allen@wirfs-brock.com>, Ian Hickson <ian@hixie.ch>
Cameron McCormack:
> Right, I don't think either of my proposals Travis quoted will work now,
> due to this bareword lookup problem.

I might be a bit wrong here.  I forgot that [[HasProperty]] uses 
[[GetProperty]] to determine if there is a property on that object or on 
its prototype chain.  That means, if my reading of the spec is right, 
the following document

   <!DOCTYPE html>
   <script>var toString; alert(toString)</script>

should alert String(Object.prototype.toString) and not "undefined". 
Firefox, Opera and IE alert "undefined".  Chrome/Safari alert the function.

So I don't know that we can make `var something;` shadow any properties 
without violating the ECMAScript spec.
Received on Thursday, 5 January 2012 23:18:03 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 17:14:05 UTC