I agree and in fact I always use explicit <head> and <body> exactly for that reason. Here I removed them to demonstrate that it is indeed not required by the standard. <head> is actually mandatory so <html></html> is invalid because it has no <head> but <title> gets <head> automatically so interestingly it is valid here. I don't like automatic wrapping so I add explicit <head> and <body> because in addition to what you pointed out it is also not obvious if a given <script> is in the head or body so the structure is not obvious. But I argue for not cluttering the code with redundant type="application/ecmascript" attributes etc.
well.. while i agree mostly..
<head>
and<body>
should be present tho.at least
<head>
, due to the fact the document object model differs between head and body when it comes to DOM selectors and search engines.I agree and in fact I always use explicit
<head>
and<body>
exactly for that reason. Here I removed them to demonstrate that it is indeed not required by the standard.<head>
is actually mandatory so<html></html>
is invalid because it has no<head>
but<title>
gets<head>
automatically so interestingly it is valid here. I don't like automatic wrapping so I add explicit<head>
and<body>
because in addition to what you pointed out it is also not obvious if a given<script>
is in the head or body so the structure is not obvious. But I argue for not cluttering the code with redundanttype="application/ecmascript"
attributes etc.fun fact, i use
<script type=module async>
these days.