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

Re: CSS Variables

From: Alex Russell <slightlyoff@google.com>
Date: Wed, 9 Feb 2011 12:00:22 -0800
Message-ID: <AANLkTi=pKC42DOxv_9-VUuUnqHTeTrHtJmqXfTBdRMPg@mail.gmail.com>
To: "Linss, Peter" <peter.linss@hp.com>
Cc: Peter Beverloo <peter@lvp-media.com>, "Tab Atkins Jr." <jackalmage@gmail.com>, Daniel Glazman <daniel.glazman@disruptive-innovations.com>, www-style list <www-style@w3.org>
On Tue, Feb 8, 2011 at 10:34 AM, Linss, Peter <peter.linss@hp.com> wrote:

> On Feb 7, 2011, at 8:39 PM, Alex Russell wrote:
>
> On Sun, Feb 6, 2011 at 4:36 AM, Peter Beverloo <peter@lvp-media.com>wrote:
> That was exactly the objection that motivated the current use of "$" in
> declaration.
>
>
>>  Therefore
>> I'd be in favor of the following:
>>
>> @var foo red;
>> bar {
>>    color: var(foo);
>> }
>>
>
> This was my preference at first, but I eventually changed my mind.
>
> After some experience with the "var()" syntax via a pre-processor, it
> eventually wound up littering our code everywhere with syntax that wasn't
> trivial to un-pack when looking at it. The final ")" can be a long way from
> the "var(" component, and it's just a whole lot to type and read.
>
>
> I don't understand that point, how far can a ')' be from the 'var('?
> There's only supposed to be a single ident in between... (and perhaps
> whitespace) I suppose you could put comments in between, but ok, don't do
> that.
>

It's longer to read and write, and just having ")" be the (variable)
distance of an indent away from the beginning "var(" makes it harder to read
to my eye.

Having tried writing and reading code from both styles, the "$" won easily,
but I don't expect you to believe me. Try it out for yourself = )
Received on Wednesday, 9 February 2011 20:01:22 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:20:37 GMT