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: Liam R. E. Quin <liam@w3.org>
Date: Fri, 18 Dec 2015 17:48:31 -0500
Message-ID: <1450478911.17824.33.camel@w3.org>
To: Simon Pieters <simonp@opera.com>, Philip Walton <philip@philipwalton.com>, "Tab Atkins Jr." <jackalmage@gmail.com>, Chris Lilley <chris@w3.org>
Cc: www-style list <www-style@w3.org>
On Fri, 2015-12-18 at 14:57 +0100, Simon Pieters wrote:
> 
[...]
> Yeah, that is a risk (hence "slippery slope"), but what other
> function would you want to negate, in practice?

sin(), cos(), sqrt(), atan(), min(), max(), log(), exp(), width-of(),
sock-size()... and of course nested calls to calc(). OK, these aren't
things you see in CSS that much today, but with transform() the trig
functions are suddenly a lot more useful...

If I define -liam-sock-size() as returning an integer, will I be able
to write --liam-sock-size()?

If conditionals were introduced as if(test, true-part, false-part)
people would want to write -if() too. And of course +calc() and +var()
should work too. But then why not
    max-width: 3em - 2px;
if -var() works?

Better to require the space than start special-casing things. Although
you could reasonably argue - is already special-cased, unfortunately,
but it's a single special case.

Liam
Received on Friday, 18 December 2015 22:48:37 UTC

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