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

Re: [css-variables] CSSVariablesDeclaration interface definition

From: John Daggett <jdaggett@mozilla.com>
Date: Wed, 27 Feb 2013 05:43:13 -0800 (PST)
To: www-style list <www-style@w3.org>
Message-ID: <1406587063.5429484.1361972593203.JavaMail.root@mozilla.com>

Tab Atkins wrote:

> > In section 4.2 of the CSS Variables spec [*], the
> > CSSVariablesDeclaration interface defines a set of methods to
> > get/set variable values.  There's also an explicit delete method. 
> > The settor method's behavior is defined as:
> >
> >   When asked to set or create the value of a variable, if varName
> >   matches the grammar of a custom property name: if varValue is
> >   the empty string, invoke the algorithm to delete a variable;
> >   otherwise, invoke setProperty() by passing varName as the
> >   property argument and varValue as the value argument.
> >
> > I don't think it's a good idea to have setting the variable to an
> > empty string delete the variable, instead I think it should be
> > treated as an invalid value. Otherwise, the behavior of the settor
> > method will differ from setProperty and will be inconcrugent with
> > setting other CSS property values where setting a property to an
> > invalid value will retain the previous value.
> 
> Read the CSSOM spec again - this matches the behavior of setProperty.

Ok, I see, setProperty has the same "remove when value is set to emptyString"
behavior.  So why does that need to be spelled out in the prose above, since
just passing it to setProperty has the same effect?

In fact, I don't quite see the point of this interface, the sole
purpose seems to be to prepend "var-" on to the property name before
calling getProperty/setProperty/removeProperty.  Is that really needed?

Cheers,

John
Received on Wednesday, 27 February 2013 13:43:42 GMT

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