Re: invalid comments among declaration blocks

On Friday 2010-11-12 04:17 +0100, Bjoern Hoehrmann wrote:
> * Alan Gresley wrote:
> >Hello all,
> >
> >What should happen here?
> 
> >.test1 { background: lime; }
> >/* .test2 { background: red; } /* css comment */
> >.test3 { background: blue; } */
> 
> Due to the second "/*" you don't have a comment token starting with the
> first "/*",

That's not true.  The complication in the COMMENT production in
http://www.w3.org/TR/CSS21/syndata.html#tokenization is there to
prevent */ from occurring in a comment, but allow /*.  It works fine
in this case, in which the comment production has parts:
  \/\*[^*]*\*+([^/*][^*]*\*+)*\/
      11111222 3333333333
such that the 11111 matches the " .test2 { background: red; } /",
the "222" matches the "*", and the "333333333" matches the " css
comment ".  The ()* is used exactly once, since there's one interior
*.

So there are just two rules with selectors .test1 and .test3, and no
syntax errors.

-David

-- 
L. David Baron                                 http://dbaron.org/
Mozilla Corporation                       http://www.mozilla.com/

Received on Friday, 12 November 2010 04:11:13 UTC