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 948 - Cannot parse some CSS comments when CSS file included in HTML
Summary: Cannot parse some CSS comments when CSS file included in HTML
Status: RESOLVED FIXED
Alias: None
Product: CSSValidator
Classification: Unclassified
Component: XHTML1.0 (show other bugs)
Version: CSS Validator
Hardware: All All
: P2 normal
Target Milestone: ---
Assignee: Olivier Thereaux
QA Contact: qa-dev tracking
URL: http://www.zap.org.au/documents/style...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-11-18 05:58 UTC by John Zaitseff
Modified: 2005-08-26 14:29 UTC (History)
0 users

See Also:


Attachments

Description John Zaitseff 2004-11-18 05:58:44 UTC
When I tried to validate the CSS of a sample page of mine, the validator 
complained that it could not parse certain items in the external print-only CSS 
file, even though that CSS file validated correctly by itself. 
 
In particular, if you try to validate 
http://www.zap.org.au/~john/web/sinorcaish/index.html, you will find that it 
complains about 
http://www.zap.org.au/~john/web/sinorcaish/sinorcaish-print.css.  The complaint 
is: 
 
    Line: 0 
    Parse Error - : none !important; } .notprinted 
 
    Line: 0 
    Parse Error - : 0 0 0.5em 0; } #main .highlight 
 
After much puzzling over this problem, I found that REMOVING the comments from 
inside the definitions made the Parse Error go away.  In other words, the 
following CSS (in that sinorcaish-print.css file) did not validate: 
 
    .hidden {   /* Used for content that should be displayed */ 
    /* by non-stylesheet-aware browsers          */ 
       display:         none !important; 
    } 
 
    .notprinted {  /* Used for content that should not be */ 
    /* printed to paper                    */ 
       display:         none !important; 
    } 
 
(and similarly for "#main h1" followed by "#main .highlight"), but the 
following version (ie, with comments removed) DID validate: 
 
    .hidden { 
       display:         none !important; 
    } 
 
    .notprinted { 
       display:         none !important; 
    } 
 
Not all such comments cause problems!  Removing the comments around "#main 
h1" / "#main .highlight" suddenly caused other definitions to be incorrectly 
parsed.  In other words, I cannot see the pattern behind it!  I can only 
suggest that comments that immediately follow a "{" are not handled correctly.
Comment 1 John Zaitseff 2004-12-01 06:39:34 UTC
The relevant page URL has been changed to: 
 
  http://www.zap.org.au/documents/styles/sinorcaish/example/index.html 
 
The relevant CSS is: 
 
  http://www.zap.org.au/documents/styles/sinorcaish/example/sinorcaish-print.css 
 
Comment 2 Yves Lafon 2005-08-26 14:29:22 UTC
Fixed, see http://qa-dev.w3.org:8001/css-validator/