Re: [css-values] Summary of calc() options regarding whitespace

On 14/05/2014 08:24, Tab Atkins Jr. wrote:
> 2. Make whitespace optional around +-, just like it is around */.
> Additionally, change Syntax so that the unit part of a dimension token
> is more restrictive than an ident, and disallows a dash followed by a
> digit.  Then, define calc()'s token handling carefully to make things
> like "calc(1+2)" (which parses as NUMBER(1) NUMBER(+2)) and
> "calc(1em-1px)" (which will parse as DIMENSION(1, em-) DIMENSION(1,
> px) after our Syntax changes).  I already have experience doing this
> for An+B, so I don't expect problems.

I’m in favor of this second option.


> This will still require authors
> to remember to put spaces around the - sign when using a function on
> the rhs (like "calc(1-attr(foo))", which is an invalid -attr()
> function) or an ident on either side, but this may be easier to
> intuitively understand.

I think this can be simplified as "a dash/minus sign next to an 
identifiers". Which isn’t too bad: many of our property names and other 
identifiers in the languages contain dashes, so it isn’t too surprising 
IMO that you have to separate a dash/minus from an identifier.


-- 
Simon Sapin

Received on Wednesday, 14 May 2014 09:19:43 UTC