[whatwg] </html> with omitted tags

Philip Taylor excors+whatwg at gmail.com
Fri Dec 26 03:55:51 PST 2008


I can start with a simple document that's probably conforming and that
the validator doesn't complain about:

  <!DOCTYPE html><html><head><title></title></head><body></body></html>

Then I can read the "Writing HTML document: Optional tags" section, which says:

  "A head element's end tag may be omitted if the head element is not
immediately followed by a space character or a comment.

  A body element's start tag may be omitted 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 may be omitted if the body element is not
immediately followed by a comment."

So I choose to omit the </head><body></body> because I think those
rules say I can do so. I get:

  <!DOCTYPE html><html><head><title></title></html>

But now I get a parse error, which I think is because the </html>
comes in the "in head" insertion mode and is "Any other end tag: Parse
error. Ignore the token.", so something seems wrong.

-- 
Philip Taylor
excors at gmail.com



More information about the whatwg mailing list