- From: Tab Atkins Jr. <jackalmage@gmail.com>
- Date: Wed, 29 Dec 2010 09:56:00 -0800
- To: "L. David Baron" <dbaron@dbaron.org>
- Cc: www-style@w3.org
On Wed, Dec 29, 2010 at 9:41 AM, L. David Baron <dbaron@dbaron.org> wrote: > calc() expressions, defined in > http://dev.w3.org/csswg/css3-values/#the-calc-min-and-max-functions , > do not allow unitless zero to be treated as a length, since the spec > says: > # The context of the expression imposes a target type, which is > # one of length, frequency, angle, time, or number. NUMBER tokens > # are of type number. DIMENSION tokens have types of their units > # (‘cm’ is length, ‘deg’ is angle etc.); any DIMENSION whose type > # does not match the target type is not allowed and must be a > # parse error. > > I think this is a good thing; the only use cases for zero lengths > that I can think of are for the output of tools that might be > generating nonzero lengths, and in such cases the tool would > presumably be generating the unit anyway. > > > However, since this isn't explicitly stated, and it might trip up > authors or implementors, I think it would be good to add a note > (near the text above) that this means that '0' is never a dimension > inside calc(), even though it is allowed to be a length outside of a > calc() expression. Agreed on all points. 0 lengths aren't very useful in calc(), machines generating them will probably put a unit in anyway, and we should have an explicit note in the spec so people don't make assumptions based on how the grammar works elsewhere in the language. ~TJ
Received on Wednesday, 29 December 2010 17:56:52 UTC