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

Re: [css-variables] CSSVariablesDeclaration interface definition

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Tue, 26 Feb 2013 22:50:42 -0800
Message-ID: <CAAWBYDCpNqg09sXFZwE3nmE6Lw1hb6A5zMEc7e-N096ApLsfjA@mail.gmail.com>
To: John Daggett <jdaggett@mozilla.com>
Cc: www-style list <www-style@w3.org>
On Tue, Feb 26, 2013 at 8:36 PM, John Daggett <jdaggett@mozilla.com> 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.

> I also think you need to state clearly the behavior for invalid values
> (variables allow lots of syntax variations for values but there are
> some values that are invalid syntax).
>
> Plus, do these methods raise exceptions and, if so, which exceptions?

Both of these are handled by the fact that I simple invoke
already-existing methods, which define the error-handling and
exception-raising.  There's no need for me to duplicate any of that
(and in fact it would be bad to do so).

~TJ
Received on Wednesday, 27 February 2013 06:51:28 GMT

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