content after </html> appended to <body> in HTML

This in unfortunate because UNIX file ends with newline. Try it yourself:

<html><body>foo</body></html> 

HTML parser appends content to <body>:

<html><head></head><body>foo 

</body></html>

XHTML parser ignores newlines and spaces, reports "Extra content at the end of the document" otherwise:

<html><body>foo</body></html>

Usually we do not see that newline but with contenteditable white-space: pre-wrap it produces visible caret: