W3C home > Mailing lists > Public > www-style@w3.org > August 2012

Re: [css-variables] Different syntax for variable definition and use

From: Marat Tanalin | tanalin.com <mtanalin@yandex.ru>
Date: Wed, 29 Aug 2012 22:59:16 +0400
To: Tab Atkins Jr. <jackalmage@gmail.com>
Cc: Jens O. Meiert <jens@meiert.com>,"www-style@w3.org" <www-style@w3.org>
Message-Id: <104341346266756@web18d.yandex.ru>
29.08.2012, 22:32, "Tab Atkins Jr." <jackalmage@gmail.com>:
>> ššššš.example {
>> ššššššššš@var {
>> šššššššššššššlink-color: #0d0;
>> ššššššššš}
>> ššššš}
>>
>> ššššš.example A {color: var(link-color); }
>>
>> šand have all inheritance benefits that current CSS-variables draft has, but without confusing `var-`-prefixed syntax for variable declaring: variable name inside `@var` rule and inside `var()` function are _identical_ and thus totally intuitively connected with each other.
>>
>> šWith this scenario, we probably would not need to separate syntaxes for variables as custom properties and variables as macros, we could use same syntax for both.
>>
>> š[1] http://lists.w3.org/Archives/Public/www-style/2012Jun/0060.html
>
> Your proposal is identical to current CSS variables, just with a different
> syntax.

More precisely, my proposal is not just different, it's at least _less confusing_ and _more intuitive_ than current CSS draft: variable name inside `@var` rule and inside `var()` function are _identical_ and thus totally intuitively connected with each other (that's what current thread by Jens is about).

> If we have global variables, if makes sense to take full advantage of
> them, and let them be a full macro mechanism so that you can, for
> example, substitute them into selectors and such.

Why do you consider this impossible?

    @var {
        some-selector: ".example > UL";
    }

    var(some-selector) {
        list-style: none;
    }
Received on Wednesday, 29 August 2012 18:59:47 GMT

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