Re: [css3 animations][css3 transitions] ambiguous or unclear shorthand grammar

On Friday 2012-09-21 05:38 -0400, Carine Bournez wrote:
> On Thu, Sep 20, 2012 at 12:17:23PM -0700, L. David Baron wrote:
> > > > Also there's surely an ambiguity since animation-name and animation-fill-mode both
> > > > allow "none" as a value. (maybe change one of those 2 names?)
> > > 
> > > This is true for any keyword value of another property interacting
> > > with animation-name, since animation-name accepts any keyword.  (See
> > > http://lists.w3.org/Archives/Public/www-style/2011Apr/0344.html .)
> 
> For this one, I was wondering why animation-name was not a string. But even
> if it were, there would still be the problem of 'none'. Your suggestion
> to check animation-name last would make the first 'none' always considered as
> an animation-fill-mode when you see 'none' twice in a single animation, but
> since the shorthand has comma-separated animations, it might be difficult
> for a stylesheet writer to detect errors like a missing comma (a 2nd 'none'
> being in a 2nd animation and that gets interpreted as an animation-name of
> the first animation).
> It seems easier to change one of those 2 'none' to something else. The 
> potential conflict of the animation-name with a keyword is much less likely.

I think the chance of real problems arising from this are pretty
low, because of the following:

First, animation-name: none is basically a special value for
disabling an animation or set of animations; there's really no
reason to use it with a list, only on its own, since when
animation-name is none all the other properties are irrelevant.

Second, since 'none' is the initial value of animation-name, when
animation-name is not specified in the shorthand, it will be
implicitly specified as 'none' (since that's how shorthands
generally work; they fill in unspecified values with initial
values, except in the exception cases where other values are
repeated, like margin).

So, combinining these two, the only common use:
  animation: none
is going to be fine, since even though the 'none' is
'animation-fill-mode', this still results in every animation
property being set to its initial value.  ('animation: 0s',
'animation: normal', 'animation: 1', and 'animation: running' have
the same result, though in reality many more values have the same
effect since they set 'animation-name' to 'none'.)


Finally, this is used way too much on the Web to take the
compatibility hit of changing it at this point.

> > (Though I'm not especially happy about having to use <time> directly
> > in the production for the shorthand; maybe I should introduce
> > <single-transition-duration> = <time>, etc.)
> > 
> > I also noticed that the spec didn't say what to do when 'none'
> > (for 'transition-property') occurred in a 'transition' shorthand
> > with more than one item.  I specified in prose that the shorthand is
> > invalid when that happens, but I didn't try to express it in the
> > grammar.
> 
> Why should it be invalid (apart from the fact that it seems a stupid thing
> to write)?

Because 'transition-property' only takes 'none' alone, not within
items:
http://dev.w3.org/csswg/css3-transitions/#transition-property
so if it weren't invalid, it would mean the shorthand is producing
an invalid value for one of the longhands within it.

-David

-- 
𝄞   L. David Baron                         http://dbaron.org/   𝄂
𝄢   Mozilla                           http://www.mozilla.org/   𝄂

Received on Friday, 21 September 2012 16:39:15 UTC