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 20846 - For XHTML5: Warn for comments inside <style/> or <script/>
Summary: For XHTML5: Warn for comments inside <style/> or <script/>
Status: NEW
Alias: None
Product: HTML Checker
Classification: Unclassified
Component: General (show other bugs)
Version: unspecified
Hardware: PC All
: P2 normal
Target Milestone: ---
Assignee: Michael[tm] Smith
QA Contact: qa-dev tracking
URL: http://tinyurl.com/as4k9y3
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-02-01 14:39 UTC by Leif Halvard Silli
Modified: 2013-02-01 14:39 UTC (History)
0 users

See Also:


Attachments

Description Leif Halvard Silli 2013-02-01 14:39:16 UTC
ISSUE:    Situation:
       1. Authors/generators sometimes do
          <style type="text/css"><!--/*HTML comment start*/
          body{background:yellow}
          -/*HTML comment end*/--></style>
       2. This is useless but harmless in text/html since
          the HTML parser does not treat them as comments
          when they occur inside <style> or <script>
       3. But in XML, the comments *do* have effect, 
          and the above example would thus not be 
          styled and could, in fact, even be deleted
          by XML parsers

SOLUTION:

          EITHER: only warn when the first non-white-space
                  character is a comment and that comment
                  spans the entire element.
   OR EVENTUALLY: take a more drastic step and always
                  warn whenever comments occurs inside
                  <style> or <script>.