NOTE: The current preferred location for bug reports is the GitHub issue tracker.
Bug 978 - Validator doesn't require body element
Validator doesn't require body element
Status: RESOLVED INTENTIONAL
Product: Validator.nu
Classification: Unclassified
Component: General
HEAD
All All
: P2 normal
Assigned To: Nobody
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-09-05 05:49 CEST by Jonathan Geisler
Modified: 2013-09-05 07:15 CEST (History)
1 user (show)

See Also:


Attachments
bad HTML file without body element (137 bytes, text/html)
2013-09-05 05:49 CEST, Jonathan Geisler
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jonathan Geisler 2013-09-05 05:49:41 CEST
Created attachment 230 [details]
bad HTML file without body element

The validator does not require a body element for the HTML document to be considered valid.  According to the W3C candidate recommendation and current editors draft section 4.1.1, the html element must have a head and body element.  I'm attaching a simple test case that should be invalid because it is missing the body element, but passes validation anyway.
Comment 1 Michael[tm] Smith 2013-09-05 07:15:29 CEST
The start tag and end tag for the body element can be omitted. See the "Tag omission in text/html" section here:

  http://www.whatwg.org/specs/web-apps/current-work/multipage/sections.html#the-body-element

[[ 
A body element's start tag can be omitted if the element is empty, or if the first thing inside the body element is not a space character or a comment, except if the first thing inside the body element is a script or style element.
A body element's end tag can be omitted if the body element is not immediately followed by a comment.
]]