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

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

From: Boris Zbarsky <bzbarsky@MIT.EDU>
Date: Sun, 12 Aug 2012 13:10:17 -0400
Message-ID: <5027E379.50602@mit.edu>
To: Allen Wirfs-Brock <allen@wirfs-brock.com>
CC: Cameron McCormack <cam@mcc.id.au>, Brendan Eich <brendan@mozilla.com>, public-script-coord@w3.org, es-discuss@mozilla.org
On 8/11/12 10:17 PM, Allen Wirfs-Brock wrote:
> Requirements on the global object are specified here:
> http://ecma-international.org/ecma-262/5.1/#sec-15.1 It says that the
> value [[Prototype]] is implementation defined, but in practice in needs
> to inherit from Object.prototype.  So, Object.prototype seems like a
> strong candidate for being the actual [[Prototype]] value.

That's a non-starter because the global is [NamedPropertiesObject], so 
at the very least that object (the global scope polluter) needs to live 
on the proto chain somewhere below Object.prototype.

> Do onload and friends need to even exist as global object properties if
> they haven't been explicitly set?

Yes.  It's common for pages to do object-detection for particular events 
existing in an implementation by checking for the existence of the 
relevant on* in window.  In fact, that's why Gecko switched behavior 
here, now that you remind me!  See 
https://bugzilla.mozilla.org/show_bug.cgi?id=659350 and 
https://bugzilla.mozilla.org/show_bug.cgi?id=414853 and the numerous 
duplicates of the latter.

-Boris
Received on Sunday, 12 August 2012 17:10:49 UTC

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