RE: [css3-transitions][css3-values] transition-duration's inital value is '0' without a unit

> From: Tab Atkins Jr. [mailto:jackalmage@gmail.com]


> >> Gradients are the first place where there would have been
> >> ambiguity, but I'd bet it wouldn't be the last.  Using a unit makes
> it
> >> clearer what the value is meant for, anyway, which I think is worth
> >> the marginal cost of (typically) 2 extra characters per value.
> >
> > This request has nothing to do with typing whatsoever. (And given
> that
> > we're talking about units I'm even surprised this even comes up).
> 
> Sorry, it's slightly tangential.  I'm just saying, the only practical
> effect of omitting a unit is that you save two characters (for typical
> units).  The upside is your stylesheet is slightly terser.  The
> downside is your stylesheet may be slightly more difficult to read,
> because you have to remember what units the given property normally
> takes.

I honestly don't see how transition-duration:0 or width:0 are slightly 
more difficult to read. I'm afraid that's just a matter of opinion.
 
> > It's mostly about consistency for web authors as well as Values &
> Units
> > overall. I'd very much prefer to be able to say that zero value do
> not
> > need a unit anywhere as opposed to saying it's only true for lengths.
> > Quite a few people know about the latter and may be surprised to find
> > out it's an exception once they venture into the newer units.
> Especially
> > if transforms already accept unitless zero angles. Never mind that it
> > doesn't make a lot of sense to require a unit to be specified for a
> zero
> > value. The only 'worth' this really has is that it *may* allow to
> resolve
> > shorthand ambiguities.
> 
> I'll admit that I was slightly surprised when I learned that only
> lengths can have their unit omitted.  But it's a cost you pay once,
> when you see that your rule isn't working for some reason.  

The same could be said of every single feature with an arbitrarily 
inconsistent design. "Well, they're going to make the mistake once 
or twice then they'll deal with it so who cares". Even if true, that 
doesn't make it OK. 


> Units other than lengths aren't used very commonly anyway, so it's a
> minority use-case in the first place.
> 
> So, I don't see much utility in changing this; given that, I'd prefer
> to make it easier to resolve shorthands.

This, I think, is one good reason to limit this pattern to lengths.
The more units accept unitless zeroes, the likelier parsing ambiguities 
might occur in future shorthands. It's already true for non-zero values,
after all.

Bottom line: I propose to set the initial value of transition-duration
to "0s". And agree that rotate(0) is invalid; it should be rotate(0deg),
or rotate(0grad) etc., including in the spec prose.

Received on Monday, 25 October 2010 19:24:54 UTC