Re: [csswg-drafts] [css-values] Define <positive-integer>, <positive-number>, <positive-length>, etc. sub-types

The discussion on clamping column width values (#1741) made me think of this again.

One final option for terminology: Take a cue from WebIDL, and use "unsigned" for values that cannot be negative. So it would be `<unsigned-integer>`, `<unsigned-number>`, `<unsigned-length-percentage>`, etc.  For the rare cases: `<non-zero-unsigned-integer>`.

That said, I still think I prefer an explicit constraints syntax, like `<length min 0>`, as it is easier to understand on its own.

Regardless of the syntax, I still would very strongly like to add this option to the CSS grammar, so that all parser constraints on values can be expressed in the grammar.

So, I'm requesting this for the WG agenda, with the following questions for discussion:

- Should the [CSS Value Definition Grammar](https://www.w3.org/TR/css3-values/#value-defs) be expanded to allow it to express all parser-level constraints on allowed values?

- If so, how should the constraints be expressed?
  1. By adding new data type names for all existing constrained types (non-negative numbers, non-negative lengths, strictly positive integers, etc.)?
  2. Or, by adding a generic way of indicating maximum and minimum values for any numeric type?

If we can get a resolution on those points, then we can bikeshed the exact syntax in a more focused way.

-- 
GitHub Notification of comment by AmeliaBR
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/355#issuecomment-373823229 using your GitHub account

Received on Friday, 16 March 2018 19:42:20 UTC