W3C home > Mailing lists > Public > public-css-archive@w3.org > August 2016

Re: [csswg-drafts] [css-values] Add <number-optional-number> type

From: Amelia Bellamy-Royds via GitHub <sysbot+gh@w3.org>
Date: Wed, 24 Aug 2016 16:53:17 +0000
To: public-css-archive@w3.org
Message-ID: <issue_comment.created-242134550-1472057595-sysbot+gh@w3.org>
**SVG 2 has already gotten rid of `<number-optional-number>`, and 
Filter Effects should follow suit.**  
No need to add to the confusion to CSS.

`<number-optional-number>` in SVG 1.1 was for values that could take 
one or two numbers; if two, they could be comma or space separated.  
E.g., for standard deviation of a blur, you can either give one value 
that applies in both directions, or you can give two different values,
 one for x-direction and one for y.

As you've all noted, there are lots of ways to express this syntax in 
standard CSS notation.  I'm pretty sure `<number>,?<number>?` covers 
it given that CSS already makes whitespace optional so long as the 
tokenization is the same.  Or `<number>{1,2} | <number>#{1,2}` as 
@nikosandronikos suggested.

For arbitrary-length lists of items separated by comma or whitespace, 
that's another matter.  SVG has them all over the place, and the 
syntax we're currently using for SVG 2 is `[<item>#]+`, though we're 
quite happy to simplify that to `<item>#+` if it gets added to CSS 
Values & Units.

If you then allow numerical qualifications on the `#+` combinator, 
that  would allow us to nicely encapsulate the syntax for other 
properties.  For example, SVG `viewBox` would be `<number>#+{4}`: 
exactly 4 numbers, separated by any combination of whitespace or 
commas.  E.g [`viewBox="0,0 50,50"` is perfectly 
valid](http://jsbin.com/dohusakeqo/1/edit?html,output).  (Aside: just 
added an SVG issue that the current syntax we have for `viewBox` is a 

GitHub Notification of comment by AmeliaBR
Please view or discuss this issue at 
using your GitHub account
Received on Wednesday, 24 August 2016 16:53:24 UTC

This archive was generated by hypermail 2.4.0 : Tuesday, 5 July 2022 06:41:01 UTC