Re: CSS Variables Draft Proposal

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;
}

or

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


<http://css-class.com/test/variables.htm>

<http://css-class.com/test/@var%20$ie>

<http://css-class.com/test/@var%20$ie2>


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