Re: [css-variables] Empty variable values?

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.
-- 
Garrett
Twitter: @xkit
personx.tumblr.com

Received on Saturday, 9 February 2013 22:04:32 UTC