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

Re: [css-variables] Empty variable values?

From: Garrett Smith <dhtmlkitchen@gmail.com>
Date: Sat, 9 Feb 2013 14:04:05 -0800
Message-ID: <CABZUbM0SHeoWDb3qj9Uaq23y9AUK9QmHgWaEFcgouRMKjG9oUQ@mail.gmail.com>
To: Andrew Fedoniouk <news@terrainformatica.com>
Cc: "Tab Atkins Jr." <jackalmage@gmail.com>, François REMY <francois.remy.dev@outlook.com>, www-style list <www-style@w3.org>
On 2/9/13, Andrew Fedoniouk <news@terrainformatica.com> wrote:
> On Sat, Feb 9, 2013 at 9:52 AM, Garrett Smith
> <dhtmlkitchen@gmail.com>wrote:
>> The most common way to unset existing property values on a CSSRule, in
>> JS is to set them to have the empty string. What kind of situation do
>> you want to unset a variable in CSS? And in that situation, why can't
>> you set it to the empty string?
> In fact JavaScript way of doing this is very bad.
It is common and works quite well for unsetting properties.

> Consider this:
>   div::before { content: ""; }
> Empty string is valid value of the content so you cannot assign empty
> string to nullify/undefine that property
So it depends on the goals and context, right?

What do you want to have happen that can't be done already? And in
what situation?

> JavaScript shall use on of these constructs:
>   el.style.prop = null;

el.style[prop] = null (or undefined) will be a problem depending on
the value type expected. It might be converted to "null" or an error
might be thrown.
Twitter: @xkit
Received on Saturday, 9 February 2013 22:04:32 UTC

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