NOTE: The current preferred location for bug reports is the GitHub issue tracker.
Bug 858 - Document containing </body> but missing <body> is considered valid
Document containing </body> but missing <body> is considered valid
Status: RESOLVED INTENTIONAL
Product: Validator.nu
Classification: Unclassified
Component: HTML parser
HEAD
All All
: P2 normal
Assigned To: Nobody
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-09-07 11:36 CEST by John
Modified: 2013-07-02 11:42 CEST (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description John 2011-09-07 11:36:32 CEST
The following HTML is considered to be valid by the validator:

<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8" />
	<title>This ppage ha sno body</title>
</head>

content

</body>
</html>

Not that the <body> is missing here, but is being closed. If this is indeed valid HTML5 the validator should at least give a warning, as in my case Javascript did not perform properly on this page.
Comment 1 Henri Sivonen 2011-09-07 12:03:58 CEST
<body> is an omissible tag per spec. The validator is working correctly and as designed.

http://www.whatwg.org/specs/web-apps/current-work/#optional-tags
Comment 2 John 2011-09-07 12:24:33 CEST
Even though the tag is optional it is my opinion that the validator should give a warning (not an error) when a non-existing tag is being closed. I can not imagine any scenario where anybody would intentionally put a closing tag somewhere and then use the validator to check the markup and would not want to be warned about this.

Browsers will disregard this closing tag so there is no point in leaving it as is. The tag should either be fixed or removed. Somebody not interested in this would not use the validator anyway.

In my case this caused some real world problems and the validator did not warn me about this omission.
Comment 3 Simon Pieters 2011-09-07 13:29:20 CEST
(In reply to comment #2)
> In my case this caused some real world problems and the validator did not warn
> me about this omission.

What problems? Problems in old IE?
Comment 4 Michael[tm] Smith 2013-07-02 11:42:07 CEST
Stale