Re: [CSS21] minor issue: location of comment tokens

On Thu, Nov 27, 2008 at 17:00, Bert Bos <bert@w3.org> wrote:
> On Tuesday 25 November 2008 16:40, L. David Baron wrote:
>> We might still want to make it clear in the prose that a comment
>> can't appear in the middle of a token without causing it to be two
>> tokens.
(...)
> In that case we'll have to make the text longer instead of shorter :-(
> How about the following? In 4.1[1], after
>
>    COMMENT tokens do not occur in the grammar (to keep it readable),
>    but any number of these tokens may appear anywhere between other
>    tokens
>
> add this phrase and note:
>
>    or at the start or end of a style sheet. (Note, however, that
>    a comment before @charset[2] disables the @charset.)
>
> [1] http://www.w3.org/TR/2007/CR-CSS21-20070719/syndata.html#syntax
> [2] http://www.w3.org/TR/2007/CR-CSS21-20070719/syndata.html#charset


On Thu, Nov 27, 2008 at 20:54, fantasai <fantasai.lists@inkedblade.net> wrote:
> "disable" isn't quite the right word. The @charset is invalid (and therefore
> the stylesheet is invalid) if a comment appears either before or within the
> @charset statement. You need a normative exception
>
>  EXCEPT they may not appear before or within an @charset statement.

If I understand the specification ([2] as linked to by Bert, see quote
above) correctly, the @charset doesn't become invalid, but is simply
ignored. In 4.4:

    "Except as specified in these rules, all @charset rules are ignored."

The stylesheet would only become invalid if the @charset being ignored
means it can no longer be decoded. But that's already covered in 4.4
as well, and that's what the note would warn about:

    "User agents must ignore style sheets in unknown encodings."


How about changing the paragraph to this?

    COMMENT tokens do not occur in the grammar (to keep it readable),
    but any number of these tokens may appear anywhere outside other
    tokens. (Note, however, that a comment before or within the @charset
    rule disables the @charset.)


Jorrit

Received on Thursday, 27 November 2008 21:52:04 UTC