This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 5586 - Comment in selector before > operator - [regression!] - in development snapshot only
Summary: Comment in selector before > operator - [regression!] - in development snapsh...
Status: RESOLVED FIXED
Alias: None
Product: CSSValidator
Classification: Unclassified
Component: CSS 2.1 (show other bugs)
Version: CSS Validator
Hardware: PC Windows XP
: P2 normal
Target Milestone: ---
Assignee: This bug has no owner yet - up for the taking
QA Contact: qa-dev tracking
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-03-23 06:59 UTC by CecilWard
Modified: 2009-02-17 14:54 UTC (History)
1 user (show)

See Also:


Attachments
test case (22 bytes, text/css)
2009-01-21 21:15 UTC, Olivier Thereaux
Details

Description CecilWard 2008-03-23 06:59:34 UTC
See bug 4870, test case _#2_ (which was noted as being ok back then),

In the live development build http://qa-dev.w3.org:8001/css-validator/#validate_by_input this test case INCORRECTLY causes a parse error to be reported as of 2008-03-23, yet the public css validator behaves correctly. So there is a (potential) regression.

CSS fragment:
 a /**/>  b { width:0}

I believe that this is valid CSS2.1. (At least, according to the new interpretation in the CSS2.1 errata http://www.w3.org/Style/css2-updates/CR-CSS21-20070719-errata.html )

Best,

Cecil Ward.
Comment 1 Yves Lafon 2008-03-26 21:00:37 UTC
The latest patch should resolve that issue, and consider in general SP followed by a comment as a SP (per CSS21 spec).

http://qa-dev.w3.org:8001/css-validator/  updated.
Thanks,
Comment 2 Olivier Thereaux 2009-01-21 21:14:03 UTC
I have to reopen this one, as qa-dev.w3.org now gives:

Parse Error > b
Comment 3 Olivier Thereaux 2009-01-21 21:15:15 UTC
Created attachment 620 [details]
test case
Comment 4 Yves Lafon 2009-02-05 17:37:18 UTC
Hum... I see why.

COMMENT has been declared as a special token to be able to detect its presence in @charset and report it.

In the case of the combinators, it generates a match because of this:

    ( (   <PLUS> { connector = '+' ; }
        | <GREATER> { connector = '>' ; }
        | <TILDE> { connector = '~' ; }
      ) ( <S> )* 
    | ( <S> )+ { connector = ' ' ; }
    )

Doing a/**/ > b will work, as the special token is there before a <S> is parsed, however in the a /**/ > b case, the special token forces the match
(<S>+) and exist form the combinator matching part.

More in this soon (I hope).

Comment 5 Yves Lafon 2009-02-05 22:11:44 UTC
One possible fix would be to replace
 < #_S         : ( [ " ", "\t" , "\n" , "\r", "\f" ]+ ) >

by   
< #_S         : ( [ " ", "\t" , "\n" , "\r", "\f" ] ) ( <COMMENT> | [ " ", "\t" , "\n" , "\r", "\f" ] )*  >

@charset check will still work, comment is still detected when no space is before it, and it fixes this issue.
However, we should do more regression check to ensure that this workaround will work.
Comment 6 Yves Lafon 2009-02-05 22:43:20 UTC
Also in the tests, we should add
a /**/ /**/> b { color: green }
which should be reported as valid. (and incorrectly reported invalid by both the production and dev version of the validator).
Comment 7 Yves Lafon 2009-02-06 10:28:02 UTC
Fixed on qa-dev.w3.org (change to the grammar seems in sync with the scanner definition of comment handling)
Comment 8 CecilWard 2009-02-17 14:54:01 UTC
(In reply to comment #7)
> Fixed on qa-dev.w3.org (change to the grammar seems in sync with the scanner
> definition of comment handling)

Agreed. Not only does it seem that this one issue is now fixed, but the grammar change mentioned earlier, which takes a brute-force approach to making comments go away when adjacent to whitespace, is a good thing everywhere surely.

It seems that the fix has been done without causing damage to the strict requirements of @charset, which is now appears to be parsed, as it needs to be, very much as a special case, more like an atomic unit, an approach which will make @charset safe from changes elsewhere in the grammar.