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

[css-variables] Empty variable values?

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Wed, 6 Feb 2013 12:24:47 -0700
Message-ID: <CAAWBYDDdog84H0oO_wb+ENwNt5sJ_k0MswQcKKZNjmpODF127Q@mail.gmail.com>
To: www-style list <www-style@w3.org>
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.

Received on Wednesday, 6 February 2013 19:25:34 UTC

This archive was generated by hypermail 2.4.0 : Monday, 23 January 2023 02:14:24 UTC