Re: variable declarations shadowing named properties on window

On 1/23/12 2:10 AM, Cameron McCormack wrote:
> Having the named properties live elsewhere does effectively make
> [ReplaceableNamedProperties] usable only for singletons like Window
> (since otherwise it would be weird if there were multiple instances with
> an object in their proto chain that returns named properties for all
> instances at once), but that's probably not a big deal; we shouldn't be
> encouraging spec writers to use [ReplaceableNamedProperties] anyway.

The main use case is for global objects, so you can have undeclared 
global variables work "right".  And global objects are by assumption 

> But to be honest, I'm not strongly attached to this over your suggestion
> of putting the properties on Window.prototype itself, if we are not
> having a separate named properties object exist as window.__proto__.
> Boris, apart from being different from what Gecko does now, do you
> forsee any problems with sticking the named properties on Window.protoype?

In at least Gecko I suspect this would make calling DOM methods on the 
window slower because the normal JS optimizations would be disabled for 
Window.prototype.  We can make it work, obviously, but it would not be 
my preferred choice.

I can't speak to whether any other UAs would have issues with it.


Received on Monday, 23 January 2012 14:14:04 UTC