Re: Unit omission with zero length

On Nov 17, 2007, at 19:07, Bert Bos wrote:

> Henri Sivonen wrote:
>> From http://www.w3.org/TR/css3-values/#lengths :
>> "After the '0' length, the unit identifier is optional."
>> Please be more explicit about the distinction between the literal  
>> string "0" and the number evaluating to zero ("0.0", "00", ".0",  
>> etc.).
>> I now suppose that the unit identifier is optional only with the  
>> literal string "0", but initially, I read less carefully and  
>> thought that the unit identifier was optional with anything  
>> evaluating to zero.
>
> Please stop reading "carefully," you're not a computer :-)

I'm a validator developer. :-)

> What would you rather pay, 0 cents or 0.00 Euro? Which is longer, 0  
> cm, 0.0 cm or 0.0000 cm?
>
> [Answers: if you're a computer scientist, "0.0000 cm" is the longest  
> by several bytes; if you're a physicist, 0 is the least precise, so  
> it is potentially the longest; if you're a normal user of CSS: "Huh,  
> are you pulling my leg?"]

I don't have a stake in deciding what the valid syntax is, but I think  
the spec should define carefully what the valid syntax is as it  
relevant to ignoring an entire query.

I take it that you are saying that the spec text is wrong and any  
<number> evaluating to zero should be allowed with a unit.  
Fortunately, that's what I implemented already accidentally.

-- 
Henri Sivonen
hsivonen@iki.fi
http://hsivonen.iki.fi/

Received on Saturday, 17 November 2007 17:18:50 UTC