Re: requestAnimationFrame behavior on display:none iframes

On 4/10/13 6:32 PM, James Robinson wrote:
> 1.) Gmail loads up a large portion of its script in an iframe styled to
> be 0x0.  While this iframe is not display:none, it's hidden for any
> practical definition of hidden.

That's not quite true.

For example, it has a well-defined CSS viewport and hence can do media 
queries and selector matching and other CSS things, unlike a 
display:none iframe...

> If animations on hidden iframes did not tick, script that ran inside this
> iframe would not be able to animate parts of the rest of gmail UI.  I
> think this behavior would be broken.

You could make the same argument about scripts in one tab that try to 
script another one that they opened, no?

> The common problem here is that the visibility of the document
> associated with the global context that requestAnimationFrame is picked
> up from is a poor proxy for the visibility of the thing the author is
> actually trying to animate.

But that's not iframe-specific.

> context and document a bit more explicit, but it's possible that
> wouldn't have helped.

I doubt it would have changed how authors think about it.

In any case, I doubt that at this point we're going to agree on this 
issue...

-Boris

Received on Thursday, 11 April 2013 00:46:19 UTC