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

Re: [css-variables] Empty variable values?

From: Chris Eppstein <chris@eppsteins.net>
Date: Wed, 6 Feb 2013 11:43:07 -0800
Message-ID: <CANyEp6WYBHAxmkMNjwvSbHx4gSPYfqzHuJYvXq2_36q_MzwrOA@mail.gmail.com>
To: "Tab Atkins Jr." <jackalmage@gmail.com>
Cc: www-style list <www-style@w3.org>
This is the behavior that Sass has when a variable is assigned an explicit
value of `null`.

-chris


On Wed, Feb 6, 2013 at 11:24 AM, Tab Atkins Jr. <jackalmage@gmail.com>wrote:

> 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.
>
> 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.
>
> ~TJ
>
>
Received on Wednesday, 6 February 2013 19:43:35 GMT

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