<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://www.w3.org/Bugs/Public/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4"
          urlbase="https://www.w3.org/Bugs/Public/"
          
          maintainer="sysbot+bugzilla@w3.org"
>

    <bug>
          <bug_id>27818</bug_id>
          
          <creation_ts>2015-01-13 08:33:30 +0000</creation_ts>
          <short_desc>Very confusing messages if malformed comment or stray BODY element encountered in HEAD</short_desc>
          <delta_ts>2015-08-23 06:58:47 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>HTML Checker</product>
          <component>General</component>
          <version>unspecified</version>
          <rep_platform>PC</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>NEW</bug_status>
          <resolution></resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Mark Rogers">mark.rogers</reporter>
          <assigned_to name="Michael[tm] Smith">mike+validator</assigned_to>
          
          
          <qa_contact name="qa-dev tracking">www-validator-cvs</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>117064</commentid>
    <comment_count>0</comment_count>
    <who name="Mark Rogers">mark.rogers</who>
    <bug_when>2015-01-13 08:33:30 +0000</bug_when>
    <thetext>1) Very confusing error messages if malformed comment encountered in HEAD

&lt;!DOCTYPE html&gt;
&lt;html&gt;
&lt;head&gt;
&lt;-- malformed comment --&gt;
&lt;meta name=&quot;description&quot; content=&quot;blah&quot; &gt;
&lt;/head&gt;

The first part of the message is ok, though the suggested fix isn&apos;t:
&quot;Bad character - after &lt;. Probable cause: Unescaped &lt;. Try escaping it as &amp;lt;.&quot;

After that things get very confusing since the malformed comment is interpreted as the start of the BODY, and following messages are emitted:

&quot;Element meta is missing one or more of the following attributes: itemprop, property.&quot;
&quot;Attribute name not allowed on element meta at this point.&quot;

2) It&apos;s even more confusing if HEAD contains a stray BODY element added by accident:

&lt;!DOCTYPE html&gt;
&lt;html&gt;
&lt;head&gt;
&lt;br&gt;
&lt;meta name=&quot;description&quot; content=&quot;blah&quot; &gt;
&lt;/head&gt;

The first error is 
&quot;Attribute name not allowed on element meta at this point.&quot;

Took me a while to figure out (even with source code) since the error can be some distance from the trigger element, and the trigger element can be very hard to spot.

I guess error recovery on the malformed comment might be possible. The second one looks much harder to fix due to tag omission rules.

Best Regards
Mark</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>117069</commentid>
    <comment_count>1</comment_count>
    <who name="Mark Rogers">mark.rogers</who>
    <bug_when>2015-01-13 09:41:11 +0000</bug_when>
    <thetext>Thought about this a bit more. Might not be so hard to add a warning like this:

class ImplicitStartTagChecker extends Checker

and record the location of first body start tag, then complain about it if you see another body start tag.

Probably extensible to handle other confusing implicit start tag cases. 

Cheers
Mark</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>