W3C home > Mailing lists > Public > www-style@w3.org > May 2012

Re: [css21][css3-values] <positive-integer>

From: Kang-Hao (Kenny) Lu <kennyluck@csail.mit.edu>
Date: Wed, 09 May 2012 07:07:22 +0800
Message-ID: <4FA9A72A.3050007@csail.mit.edu>
To: WWW Style <www-style@w3.org>
CC: Simon Sapin <simon.sapin@kozea.fr>
(12/05/09 3:22), Boris Zbarsky wrote:
> On 5/8/12 3:15 PM, Brian Manthos wrote:
>> <positive-integer> = [0-9]+
> 
>   0*[1-9][0-9]*

\+?0*[1-9][0-9]* maybe? (assuming sign becomes part of a NUMBER token)
Or was there a reason why this is left out?

> Similar for negative-integer.
> 
> Apart from that nit, this is an excellent idea.

Agreed. It seems that people often forget about this (/me is looking at
'border-radius' and 'border'), and it would be less forgettable if this
is part of the "Value:" field.


(12/05/09 3:56), Simon Sapin wrote:
> Whether or not it appears in the "Value:" line for properties, I think
> that "positive" and such constraints should be defined in terms of
> numerical comparison, not in character-based grammar.

Why? <integer> is already a syntactical constraint (i.e. 'z-index: 1.0'
isn't valid, albeit 1.0 == 1). The questionable parts are

1. is '-0' non-negative?

CSS 2.1 has this to say

  # -0 is equivalent to 0 and is not a negative number.

, and it wasn't carried over to CSS3 V&U. I don't think numerical
comparison is a good thing to do here, otherwise whether
-0.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001
is non-negative or not depends on system precision, which seems bad.

2. can '0.0' be parsed as <length>?

CSS 2.1 has this to say

  # After a zero length, the unit identifier is optional.

, and it wasn't carried over to CSS3 V&U (Well, it has a sentence with
slightly different semantics: "A zero length may be represented instead
as the <number> ‘0’."). I don't think numerical comparison is a good
thing to do here, otherwise whether
0.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001
can be parsed as <length> or not depends on system precision[1], which
seems bad.


If this is not breaking content on the Web, my preference for the above
two questions is 'no'.


(This proposal is not compatible with CSS 2.1 for question 1. Therefore,
I am tagging the subject line as such)

[1] http://lists.w3.org/Archives/Public/www-style/2010May/0171


Cheers,
Kenny
Received on Tuesday, 8 May 2012 23:07:52 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:20:53 GMT