Re: [PageVisibility] location of the interface

On Mon, May 2, 2011 at 4:08 PM, Cameron McCormack <cam@mcc.id.au> wrote:
> Jonas Sicking:
>> I partially agree with you. However it's always iffy to place things
>> on the window object as that is the global namespace for scripts, and
>> so you have to worry about colliding with global variables.
>
> It’s fine in Firefox, where declaring and assigning to variables doesn’t
> interfere with properties from the Window object, but I see that could
> be troublesome for other browsers.  (If we could eventually get to the
> point where it is safe to extend Window across implementations that’d be
> good.)

It's only true in Firefox if people write code like:

var foo = "bar";

however not good if they write:

if (foo) {
  doStuff();
}

But I think the Window is the best place to put it as long as we use a
name that is descriptive enough that it's unlikely to collide with
existing pages. I'm not a fan of names like 'performance' which was
recently added by another spec.

/ Jonas

Received on Monday, 2 May 2011 23:31:34 UTC