W3C home > Mailing lists > Public > www-style@w3.org > July 2011

Re: [css3-animations] Effect of display:none and visibility:hidden on animations

From: Boris Zbarsky <bzbarsky@MIT.EDU>
Date: Sat, 16 Jul 2011 21:04:34 -0400
Message-ID: <4E223522.1030206@mit.edu>
To: www-style@w3.org
On 7/16/11 7:07 PM, Sylvain Galineau wrote:
> There does not seem to be agreement for display:none yet; WebKit does not run the animation and applying display:none resets the animation. But getComputedStyle() indicates Gecko animates the specified properties when display is none.
>
> WebKit's behavior is certainly performance-friendly

You need to be careful here.

Gecko normally does no style computation of any sort for elements in a 
display:none subtree (except for computing the display of the root, of 
course).  No selector matching for descendants, no computed style 
determination, no animations, etc.

_If_ you ask for the style of a node in such a subtree, then we'll go 
ahead and do the work of figuring that style out.  At that point we may 
do animations on it (though I suspect this only works on the root of the 
display:none subtree).

The behavior you see will depend on whether the node you're working with 
is the root of the display:none subtree or not, and likely on the exact 
timing of your getComputedStyle calls...

This probably does need to be specified somehow.  The problem, of 
course, is that the thing that triggers animations (determination of 
computed style) doesn't occur at a defined time.  Or rather conceptually 
it happens for all elements immediately but no UA actually does that.

-Boris
Received on Sunday, 17 July 2011 01:05:13 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:20:42 GMT