"var" declarations shadowing properties from Window.prototype
bzbarsky at MIT.EDU
Sun Aug 12 10:10:17 PDT 2012
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=414853 and the numerous
duplicates of the latter.
More information about the es-discuss