W3C home > Mailing lists > Public > public-css-archive@w3.org > July 2018

Re: [csswg-drafts] [css-animations-1] Removing the target of an animation has different behaviour between CSS Animations, CSS Transitions and Web Animations

From: Brian Birtles via GitHub <sysbot+gh@w3.org>
Date: Tue, 24 Jul 2018 23:19:34 +0000
To: public-css-archive@w3.org
Message-ID: <issue_comment.created-407582494-1532474373-sysbot+gh@w3.org>
I believe the distinction here is that for CSS animations and CSS transitions the animation is defined by style whereas for the API it is defined by script.

Last I checked, there was some mismatch about what the the spec and implementations do about `getComputedStyle` for elements that are not part of the document tree but the CSS Cascading spec seems to make it pretty clear they don't have computed values (see [Value Processing](https://drafts.csswg.org/css-cascade-4/#value-stages)). Certainly CSS transitions takes this interpretation:

> Various things can cause the computed values of properties on an element to change. These include insertion and removal of elements from the document tree (which both changes whether those elements have computed values and can change the styles of other elements through selector matching) ([3. Starting of transitions](https://drafts.csswg.org/css-transitions/#starting))

Similarly, since `display:none` omits the element from the box tree, those elements also won't have animations defined by the cascade as made explicit in CSS animations:

> Setting the display property to none will terminate any running animation applied to the element and its descendants. If an element has a display of none, updating display to a value other than none will start all animations applied to the element by the animation-name property, as well as all animations applied to descendants with display other than none. ([3. Animations](https://drafts.csswg.org/css-animations/#animations))

Since animations defined by the API don't rely on the cascade to be defined, they can continue to run even when the element not included in the box tree. That is, in the absence of anything saying they don't run on such elements (unlike CSS animations/transitions), they should run.

-- 
GitHub Notification of comment by birtles
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/2948#issuecomment-407582494 using your GitHub account
Received on Tuesday, 24 July 2018 23:20:14 UTC

This archive was generated by hypermail 2.4.0 : Tuesday, 19 October 2021 01:30:53 UTC