Re: [css-variables] Empty variable values?

Le 06/02/2013 12:24, Tab Atkins Jr. a écrit :
> While making the recent commits, I made the grammar of custom properties be:
>
> [ <value> | <CDO> | <CDC> ]*
>
> This means that the value of a custom property can be nothing.
>
> This is useful from an authoring perspective - without it, variables
> can't ever be used to control something which has a special effect
> when omitted, like the "inset" keyword in box-shadow.
>
> It violates the CSS 2.1 Section 4 grammar, though, which requires
> property values to contain at least one non-comment or whitespace
> token.  However, it's not technically problematic - the Syntax spec
> accidentally handled it already.

Looks good.


> I believe Glenn brought up a related issue, which is that it would be
> difficult to tell in the OM between a property set to nothing and one
> not set at all.  This can be avoided by using the new "var" property
> on CSSStyleDeclaration, as only valid variables show up there.  (You
> can use " 'foo' in style.var " to test it.)  This is the intended
> method to interact with variables anyway, as it's more convenient, so
> we can probably ignore this issue.

Can’t we handle that with null (not set) vs. empty string?

-- 
Simon Sapin

Received on Wednesday, 6 February 2013 19:46:20 UTC