Good afternoon all,
I’ve just realised that this piece of code validates as 100% valid HTML5:
<!doctype html>
<html>
<title>asd</title>
<script src="Js.js"></script>
<script>alert('1');</script>
</html>
MDN states that the permitted parent elements of the <script> tag is:
Any element that accepts metadata elements, or any element that accepts phrasing content. (source)
I was wondering does anyone know what does a metadata element mean? What does phrasing content mean?
Source: https://developer.mozilla.org/en/HTML/Content_categories#Metadata_content
The reason why your document validates even without
<head>and<body>is that they became optional in HTML5. Actually, even<html>is optional so the following code is valid HTML5, too: