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

On Wed, Aug 15, 2012 at 8:16 AM, Boris Zbarsky <bzbarsky@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.

Received on Friday, 17 August 2012 01:16:01 UTC