W3C home > Mailing lists > Public > www-style@w3.org > December 2015

Re: [css-variables] Is making a property negative via `-var(--width)` valid syntax?

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Fri, 18 Dec 2015 10:47:22 -0800
Message-ID: <CAAWBYDDhjBFuUR8pjvzWKkyiijY8SE23wjcaPSqHB+CzUQAn4w@mail.gmail.com>
To: Simon Pieters <simonp@opera.com>
Cc: Philip Walton <philip@philipwalton.com>, www-style list <www-style@w3.org>
On Fri, Dec 18, 2015 at 3:05 AM, Simon Pieters <simonp@opera.com> wrote:
> On Fri, 13 Nov 2015 18:33:28 +0100, Tab Atkins Jr. <jackalmage@gmail.com>
> wrote:
>> As Boris says, FF's behavior is correct.  `-var(...)` is a function
>> named -var, which is not a variable reference. You can't negate
>> functions like that *anywhere* due to the way ident parsing works;
>> it's not specific to variables.
> But it seems to me you're only likely to want it for var(). Since this
> appears to be a pattern people use in the preprocessor world, should we just
> support it? It wouldn't be difficult to define a new -var(x) function as
> calc(-1 * var(x)), right? Too much of a hack? Slippery slope?

I feel like it's too much of a hack. I don't like reinterpreting
syntax like this.  It implies, for instance, that `+var(...)` is also
valid, and presumably a no-op.  And as Chris says, authors will expect
other numeric functions, if they exist, to support this as well.

Received on Friday, 18 December 2015 18:48:08 UTC

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