"var" declarations shadowing properties from Window.prototype

Thaddee Tyl thaddee.tyl at gmail.com
Thu Aug 16 18:15:34 PDT 2012

On Wed, Aug 15, 2012 at 8:16 AM, Boris Zbarsky <bzbarsky at mit.edu> wrote:
> On 8/15/12 3:48 AM, Axel Rauschmayer wrote:
>> In FF 14, I’m getting the following results (if there is an element
>> whose ID is "foo"):
>>      $ "foo" in window
>>      false
>>      $ foo
>>      ReferenceError: foo is not defined
> This is an artifact of how the repl you're using (presumably the Web Console
> in Firefox) is implemented.  In particular, if you're using the Web Console
> its global is NOT the window, which allows you to declare variables visible
> in the repl but not leaking to the web page.  But it leads to some weird
> artifacts with the global scope polluter, since there isn't one here,
> really.

I'd like to add that this is a genuine bug in the Web Console, not the
way we meant it to behave.
`window.Object instanceof Object` is meant to be true.

See bug https://bugzilla.mozilla.org/show_bug.cgi?id=774753 about it.
Use Firebug's console to avoid running into those issues.

More information about the es-discuss mailing list