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

RE: [css-variables] Empty variable values?

From: François REMY <francois.remy.dev@outlook.com>
Date: Fri, 8 Feb 2013 11:16:21 +0100
Message-ID: <DUB406-EAS361871C3E311A520417474DA5050@phx.gbl>
To: "'Tab Atkins Jr.'" <jackalmage@gmail.com>, "'www-style list'" <www-style@w3.org>
± 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.

I'm in favor of a semantic where setting a property to an empty value undeclares the property, mimicking the element.style behavior which exposes an empty string for undeclared properties (and where setting a property to an empty string remove the property declaration). 

So, my proposal would be to accept the empty string value as a way to reset the custom property to a unset state:

    #selector {
        my-property: 1;

    #selector > * {
         my-property:; /* unset the property */

    qS("#selector > *").computedStyle.myProperty // empty string
    qS("#selector > *").computedStyle.my.property // undefined

If we do not go that way, it becomes very difficult to undeclare a custom property. Do we really want people to rely on [[Delete]] semantics to undeclare a property?
Received on Friday, 8 February 2013 10:16:57 UTC

This archive was generated by hypermail 2.4.0 : Friday, 25 March 2022 10:08:26 UTC