W3C home > Mailing lists > Public > www-style@w3.org > February 2013

Re: [css-variables] Empty variable values?

From: Simon Sapin <simon.sapin@kozea.fr>
Date: Wed, 06 Feb 2013 12:45:56 -0700
Message-ID: <5112B2F4.7060703@kozea.fr>
To: "Tab Atkins Jr." <jackalmage@gmail.com>
CC: www-style list <www-style@w3.org>
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 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:21:05 GMT