Re: CSS Variables Draft Proposal

On Thu, Feb 10, 2011 at 8:03 PM, Alan Gresley <alan@css-class.com> wrote:
> 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;
> }

Adding the {} doesn't make it any easier to drop invalid values.


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

Luckily, we don't care how IE7 acts, since it'll never support
variables.  In particular, the behavior you point to above (about
broken handling of @import) isn't relevant to error-handling of @var
rules, since this proposal doesn't involve statement of that form.

~TJ

Received on Friday, 11 February 2011 17:34:56 UTC