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 4893 - XML CDATA marked sections
Summary: XML CDATA marked sections
Status: RESOLVED FIXED
Alias: None
Product: CSSValidator
Classification: Unclassified
Component: XHTML1.0 (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: 2007-07-30 16:27 UTC by Chris Lilley
Modified: 2009-02-26 14:37 UTC (History)
1 user (show)

See Also:


Attachments

Description Chris Lilley 2007-07-30 16:27:29 UTC
The CSS validator doesn't seem to know about CDATA marked sections in XML.

So for example

<style type="text/css"><![CDATA[ 
      .note 
      { 
         color:green 
      }
   ]]></style>

gives an error

Lexical error at line 1, column 3. Encountered: "[" (91), after : "<!"

The CSS parser should not see this syntax because the XML parser removes it. It looks as if whatever is doing the parsing is not XML; alternatively, its the CSS pasrser (which allows HTML and XML comments, <!-- --> in CSS due to common bugwards-compatible ways of hiding CSS from older HTML browsers).
Comment 1 Olivier Thereaux 2009-02-26 14:26:06 UTC
Relevant to this, when serving as text/html:
http://www.w3.org/TR/xhtml-media-types/#C_4
Comment 2 Yves Lafon 2009-02-26 14:37:23 UTC
A few test cases:
http://www.w3.org/2009/02/xhtmlcss.html
served as application/xhtml+css, cdata section not escaped.
The validator accept it as it should.

http://www.w3.org/2009/02/xhtmlcss.html
served as text/html, cdata section not escaped.
The validator refuses to parse it as it should. (although the error should be better than it is now)

http://www.w3.org/2009/02/xhtmlcssescaped.html
served as text/html, cdata section escaped per http://www.w3.org/TR/xhtml-media-types/#C_4
The validator accept it as it should.