W3C home > Mailing lists > Public > www-validator-cvs@w3.org > August 2006

[Bug 3313] Validator does not accept comments between tokens

From: <bugzilla@wiggum.w3.org>
Date: Wed, 23 Aug 2006 02:01:05 +0000
CC:
To: www-validator-cvs@w3.org
Message-Id: <E1GFi3F-0002tv-6y@wiggum.w3.org>

http://www.w3.org/Bugs/Public/show_bug.cgi?id=3313





------- Comment #1 from cecil@cecilward.com  2006-08-23 02:01 -------
(In reply to comment #0)
> The CSS2.1 spec says that comments can appear between any two tokens.
> In this CSS stylesheet:
>   http://www.mit.edu/~cananian/tsE/stylesheet.css
> The CSS validator complains about the context "ieMacOnly" which is the
> following code (an unfortunately necessary workaround for an IE/Mac bug):
> /* \*/ ieMacOnly /**/
> * html #sidebar { position: absolute; top:175px; left:0; margin-left: 0; }
> This should be parsed as the selector:
> ieMacOnly * html #sidebar
> but the CSS validator is choking on it.
> (There's also some CSS which is *actually* invalid in that stylesheet, in the
> "#beaver" context, which is an evil microsoft-specific style needed to get
> transparent PNGs to work.  That has no impact on the actual bug discussed
> above.)
> The URLs cited in this bug report are temporary; email me if they have
> disappeared by the time you are looking at this bug.

Minimal test case:

I note that the validator gives an "incorrect" fail on
test case (ii):
    a /**/ b {}
which is legal CSS 2.1 (according to my reading, although the distribution of
comments is unfortunately not described adequately in the "formal" grammar in
the appendix).

FYI, note that the validator correctly indicates success on
test case (iii):
    a/**/ b {}

It is possible that the "fault" in the validator might be to do with parsing
(ii) as  "ident combinator combinator ident" where combinator=SP+ (ie
descendant operator), which is illegal in terms of the grammar in the appendix.

This suggests that the grammar of CSS is self contradictory, that the statement
"whitespace may occur between any two tokens" is unsupportable, as effectively
comments may not occur in this position in selectors. If my understanding turns
out to be correct this is bad language design and the validator is correctly
interpreting a poor grammar.

One way out would be to do something like define a comment as {w}*COMMENT in
CSS2.1 (similar to COMMA) possibly?

[An aside, I note that
test case (iv)
    a/**/b {}
is rejected if CSS2.1 is the selected grammar, which seems to be an error in
the validator contradicting CSS2.1 in that a comment ought to be mapped into
whitespace, not into null, so a comment should equal a combinator=descendant
operator in this position. If my understanding is correct, this is a separate
fault, and should be reposted separately. I unclude this here for some
background. This affects a number of other situations and is critical for
interpretation, ie.  is   [attr1]/**/[attr2] read as [attr1] [attr2] or as
[attr1][attr2] ? - which mean completely different things!.]

Cecil Ward.
Received on Wednesday, 23 August 2006 02:01:15 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 15:17:25 UTC