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

Re: Proposal for adding variable declaration blocks

From: Francois Remy <fremycompany_pub@yahoo.fr>
Date: Fri, 18 Jul 2008 22:50:49 +0200
Message-ID: <05FF269BF5CD4A428F37D746CF3FB0F1@FremyCompany1>
To: "Simetrical" <simetrical@gmail.com>
Cc: "James Elmore" <James.Elmore@cox.net>, "www-style list" <www-style@w3.org>

From: "Simetrical" <simetrical@gmail.com>
To: "Francois Remy" <fremycompany_pub@yahoo.fr>
> 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=.

Yes =varName is ugly, I agree with you.

>> 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.

I was not aware of the disponibility of the calc function.

> The last one can just be
> color: blue;
> color: tColor;

Yes, in fact.
But it should be : << color: blue; color: var(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.

It's not for nothing that I like ECMAScript :-)

>> 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.

You're true, here. So, we should keep the var() syntax.

Note that some CSS functions provides some multiple syntax.
    border (thin > 2px; medium: 3px; thick > 5px)
    color: (red > #ff0000; ...)
    font-size: (2ex > 1em);

But this is not exactly the same as two syntax, its only contants.
Received on Friday, 18 July 2008 20:51:29 UTC

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:27:38 UTC