Re: [css3-animations] can inserting a @keyframes rule start an animation?

On Mon, Oct 7, 2013 at 4:24 PM, Ralph Thomas <ralpht@gmail.com> wrote:
> Hi www-style,
>
>   I recently added an optimization to WebKit to not perform a full
> style recalc when inserting a @keyframes rule[1], which raised the
> question from Simon Fraser:
>
> "If an element has: -webkit-animation-name: foo and you insert
> @-webkit-keyframes foo {...}, does the animation start?"
>
> WebKit does not start an animation in this case (and didn't prior to
> my change), but Firefox does. The CSS 3 Animations spec doesn't
> directly address the issue, but does say:
>
> "If the name does not match any keyframe at-rule, there are no
> properties to be animated and the animation will not execute."
>
> So which is the correct behavior, and can we amend the spec to make
> this explicit?

Yes, an animation should start.  CSS is declarative, and doesn't have
any notion of time (except where absolutely necessary, like defining
when precisely an animation/transition starts).

As soon as an animation-name property refers to a valid @keyframes
rule, the animation must start.  Anything else is just introducing
horrible time-ordering requirements into a language that doesn't
actually *have* any time-ordering requirements.

This is identical to the behavior of font-family and @font-face.

~TJ

Received on Monday, 7 October 2013 23:37:01 UTC