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

Re: [css-variables] Empty variable values?

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Sat, 9 Feb 2013 09:53:07 -0700
Message-ID: <CAAWBYDD30bmAcZns8YVb_tnTGSt2xqjLyyRoFNnrRY3HAz=+DQ@mail.gmail.com>
To: François REMY <francois.remy.dev@outlook.com>
Cc: www-style list <www-style@w3.org>
On Fri, Feb 8, 2013 at 3:16 AM, François REMY
<francois.remy.dev@outlook.com> wrote:
> ± 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).

That does not address the use-case I presented for the proposal, which
is to allow variables to substitute nothing for themselves, which is
required for some semantics where the lack of a value is different
from any value you can provide.  (It's also convenient for some other
cases, like lists of values.)

> 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?

Why is it difficult?  The standard way to delete a property in JS
still works ("style.removeProperty('var-foo')"), and I've added a
second way using the convenience API ("delete style.var.foo").

~TJ
Received on Saturday, 9 February 2013 16:53:54 GMT

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