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

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