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 27818 - Very confusing messages if malformed comment or stray BODY element encountered in HEAD
Summary: Very confusing messages if malformed comment or stray BODY element encountere...
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:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-01-13 08:33 UTC by Mark Rogers
Modified: 2015-08-23 06:58 UTC (History)
0 users

See Also:


Attachments

Description Mark Rogers 2015-01-13 08:33:30 UTC
1) Very confusing error messages if malformed comment encountered in HEAD

<!DOCTYPE html>
<html>
<head>
<-- malformed comment -->
<meta name="description" content="blah" >
</head>

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

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

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

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

<!DOCTYPE html>
<html>
<head>
<br>
<meta name="description" content="blah" >
</head>

The first error is 
"Attribute name not allowed on element meta at this point."

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
Comment 1 Mark Rogers 2015-01-13 09:41:11 UTC
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