What are the disadvantages of ignoring <html> and <body>
They are clearly optional in the specification (so the document will still be valid).
This was true since the original specification (which states <!ELEMENT HTML OO (( HEAD | BODY | %oldstyle)*, PLAINTEXT?)> , OO value of Start Tag Optional, End Tag Optional) through into the current specification (in which says: "The start tag of the html element can be skipped if the first thing inside the html element is not a comment. The end tag of the element can be omitted if the html element does not immediately follow the comment.").
They are required only in XHTML because XML does not have the concept of additional tags.
I have never seen any browser or user agent not be able to correctly process them in an HTML document. (Note that although tags are optional, elements are not, so browsers will insert HTML, HEAD, and BODY elements even if there are no tags, so any script that tries to find them in the DOM will still work).
The only technical drawback is that you cannot put attributes in tags that aren't there, and the lang attribute for the HTML element is useful.
Leaving them, you can confuse other people who need to maintain your code that does not know that tags are optional.
The <head> and <body> tags are optional in HTML5. Actually, the Google HTML style guide is recommended so as not to use them:
<!-- Not recommended --> <!DOCTYPE html> <html> <head> <title>Spending money, spending bytes</title> </head> <body> <p>Sic.</p> </body> </html> <!-- Recommended --> <!DOCTYPE html> <title>Saving money, saving bytes</title> <p>Qed. Without using these tags, some of the disadvantages include:
- that it is very different from what is usually studied by developers, so this can cause some confusion.
- limitation that the comment cannot be immediately after the
<html>, which is omitted.
Repeating the optional nature of tags from spec :
The start tag of an html element can be omitted if the first thing inside the html element is not a comment.
A body An 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 comment, except that the first thing inside the element’s body is a meta, link, script, style, or template element.
See: