W3C home > Mailing lists > Public > www-style@w3.org > July 2008

Re: Proposal for adding variable declaration blocks

From: Simetrical <simetrical@gmail.com>
Date: Fri, 18 Jul 2008 16:24:47 -0400
Message-ID: <7c2a12e20807181324j68452bbfg67c049318a9bf740@mail.gmail.com>
To: "Francois Remy" <fremycompany_pub@yahoo.fr>
Cc: "James Elmore" <James.Elmore@cox.net>, "www-style list" <www-style@w3.org>

On Fri, Jul 18, 2008 at 4:14 PM, Francois Remy
<fremycompany_pub@yahoo.fr> wrote:
> I don't like $varName. I much prefer var(varName);

I don't care, honestly.  var() is more CSS-style.  I just prefer
$varName over =varName or =varName=.

> If we choose for var(varName), it will be possible later to add some other
> functions like :
>
>   var(oHeight + '5px')
> or
>   var(oWidth * 3)
> or
>   var('10%' - ('50px' * 2))
> or
>   color: var(iif(isDefined('tColor'), tColor, 'blue'))

You mean like the already-existing calc() function?  calc(
var(oHeight) + 5px ) or calc( $oHeight + 5px ) or whatnot should
already work, in browsers that support calc() as well as variables,
since variables are just another data type.  I assume that's the
intent, anyway.

The last one can just be

color: blue;
color: tColor;

since the second statement will be silently dropped if tColor is
undefined.  Adding generic conditionals would probably make CSS
Turing-complete, which I believe is something that's intentionally
avoided to ensure simplicity and speed.  If you need complex
conditionals that actually require things like iif(), that's what
JavaScript is for.

> PS : I'm not against $varName as shortcut of var(varName);

Keeping one syntax for doing one thing should definitely be a goal
here.  Pick one or the other, don't take the "add all the syntaxes
people might like and let them pick" approach.
Received on Friday, 18 July 2008 20:25:25 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 27 April 2009 13:55:10 GMT