W3C home > Mailing lists > Public > public-web-perf@w3.org > May 2011

Re: [PageVisibility] location of the interface

From: Jonas Sicking <jonas@sicking.cc>
Date: Mon, 2 May 2011 16:30:37 -0700
Message-ID: <BANLkTino+2RCmoQ9Cb7Fa7WXRYJeOWAk8A@mail.gmail.com>
To: Jonas Sicking <jonas@sicking.cc>, public-web-perf@w3.org
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 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 2 May 2011 23:31:35 GMT