Bugzilla – Bug 858
Document containing </body> but missing <body> is considered valid
Last modified: 2013-07-02 11:42:07 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.
<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
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.
(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?
Stale