Re: [css-variables] CSSVariablesDeclaration interface definition

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 UTC