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

Re: CSS Variables Draft Proposal

From: Alan Gresley <alan@css-class.com>
Date: Fri, 11 Feb 2011 15:03:50 +1100
Message-ID: <4D54B526.70206@css-class.com>
To: "Linss, Peter" <peter.linss@hp.com>, Alex Robinson <css-discuss@alex.fu2k.org>
CC: "L. David Baron" <dbaron@dbaron.org>, Tab Atkins <jackalmage@gmail.com>, www-style list <www-style@w3.org>, Daniel Glazman <daniel.glazman@disruptive-innovations.com>
Caveat, I may be way off the mark here. If so please ignore.

On 11/02/2011 12:23 PM, Linss, Peter wrote:

>>>> Do we really want that?
>>>> How about:
>>>> @var $foo url(;
>>>> @var $bar );
>>>> p { content: $foo http://example.com/yikes.gif $bar }
>>> Oh jeezus no.  I don't know the precise details of url() parsing, but
>>> either that is parsed into a single $foo variable containing
>>> "url(;\n@var $bar )", or they're both invalid.  Either way works for
>>> me.
>> Even if variables represent a token-stream, we should require that
>> they be (), {}, and [] -balanced.
> We also need to prohibit ':' from being in a variable value.
> Now, how about:
> @var $foo */;
> Or if at runtime I change a variable value to "/*"?
> I think the "token stream" concept is opening us up to a word of hurt...
> Variable values are going to need to be very tightly restricted... and/or
> the rules of variable expansion. The more I think about "hixie style evil
> test cases" the more I think variable values should be only a single
> property value.

This is why I don't like this format,

@var $foo whatever;

and prefer something that is easy dropped.

@var $foo {
     color: red;


@var foo {
     color: red;

On 11/02/2011 12:34 PM, Daniel Glazman wrote:
> Le 11/02/11 02:15, Linss, Peter a écrit :
>> Don¹t forget this case:
>> @var $foo /*this_is_a_valid_url*/; p { content: url($foo); }
>> Is it a comment or not?
> Never. A comment is explicitely said to be able to happen anywhere
> between tokens in the grammar and you can almost consider it's
> stripped before tokenization (even if of course it is not).
> The variable assignment above is always reduced to @var $foo ;

I guess you never messed with hacking IE7 or earlier version with 
@imports. Maybe most decent browsers may drop poorly written CSS 
(grammar wise) but IE7 or earlier will eat many things.




And the way some versions of IE treat comments and other tokens, we 
don't want loose tokenization.

Alan http://css-class.com/

Armies Cannot Stop An Idea Whose Time Has Come. - Victor Hugo
Received on Friday, 11 February 2011 04:04:26 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 11 February 2015 12:34:48 UTC