It’s just sloppy coding that does not cause visible harm when the “self-closing” <div id="map-canvas"/>
is the sole content of the body
element. It is treated by browsers as if the slash /
were not there, i.e. as an opening tag (only). They will then imply a closing tag when they encounter the end of the enclosing element, </body>
. Things would be different if there were content after the “self-closing” tag.
It would be a real self-closing tag if it were used in XHTML in a document processed by XHTML rules, but it isn’t. The document lacks the required xmlns
attribute, and it is practically certain that it is sent with the text/html
content type, hence processed as HTML, not as XHTML.
Appendix C of the XHTML 1.0 spec says: “Given an empty instance of an element whose content model is not EMPTY
(for example, an empty title or paragraph) do not use the minimized form (e.g. use <p> </p>
and not <p />
).”