Re: [css3-syntax] !important vs. ! /**/ important

On Tue, Aug 7, 2012 at 6:24 AM, Simon Sapin <simon.sapin@kozea.fr> wrote:
> Le 06/08/2012 20:00, Daniel Glazman a écrit :
>> Le 06/08/12 19:41, Simon Sapin a écrit :
>>> Le 06/08/2012 18:11, Tab Atkins Jr. a écrit :
>>>> Ah, true. Hmm, is Selectors the only place that has this issue? I
>>>> think so - I believe everywhere else, two tokens being separated
>>>> implies that it's okay to put whitespace between them.
>>>
>>>
>>> What about !important ? Is this valid? ! /**/ important
>>
>>
>> CSS 2.1 grammar says:
>>
>>   "!"({w}|{comment})*{I}{M}{P}{O}{R}{T}{A}{N}{T}        {return
>> IMPORTANT_SYM;}
>>
>> So, yes.
>
> This is not the case in the current Syntax3 ED. In 3.6.8:
>
>> delim token with a value of "!"
>>   If the next input token is an identifier token with the value
>>   "important", …
>
> Note that comments are ignored by the tokenizer, but they can still separate
> whitespace tokens which then become consecutive. Fixing the above might need
> unbounded lookahead, unless the tokenizer changes to collapse
> comment-separated whitespace so that there can not be consecutive whitespace
> tokens.

Yeah, I saw that. :/

Either we need to accept this as a change in the grammar (which I
doubt anyone would ever hit without specifically trying to exercise
the "comments can be placed anywhere!" rule), or yeah, we need
infinite lookahead to recognize !important.  I can't do whitespace
collapsing, even, because you can have an unbounded number of
*comments* between the two tokens as well.

~TJ

Received on Tuesday, 7 August 2012 15:37:08 UTC