Re: bug: didn't close the head and it still validates

Loek Wetzels (Airglow Studios), Tue, 9 Mar 2010 15:22:43 +0100:
> I used http://validator.w3.org/check to validate (simplified):
> 
> ___________________________
> 
> <!DOCTYPE html>
> <html xmlns="http://www.w3.org/1999/xhtml" lang="en-us">
> 
> 	<head>
> 		<meta charset="UTF-8" />
> 		<title>test</title>
> 	
> 	<body>
> 		bla
> 	</body>
> </html>
> 
> ____________________________
> 
> 
> As you can see there's no </head> but still it validates:
> 
> This document was successfully checked as HTML5!
> Result: 	Passed, 1 warning(s) (Using experimental feature: HTML5 
> Conformance Checker.)

You have validated an HTML5 document. Not an XHTML5 document. The 
presence of "xmlns="http://www.w3.org/1999/xhtml" doesn't turn it into 
an XHTML document. In HTML documents - unlike in XHTML documents - it 
has always been permitted to skip the tags for HEAD, BODY and HTML.

Perhaps we could put it like this: The current XHTML specifications 
define a way to serve an XHTML document in an HTML4 parser compatible 
syntax - the infamous Appendix C. But (un)fortunately, there aren't 
validators which validate against Appendix C. Consequently you are 
permitted to use a '<p />' in an XHTML document, despite that web 
browsers will treat it like an '<p>'.

Whereas HTML5 (if we simplify/generalize) takes the opposite approach: 
It tries to permit in HTML (text/html) anything which doesn't break the 
parsing of an HTML document. Hence it permits '<html 
xmlns="http://www.w3.org/1999/xhtml">' because it doesn't break an HTML 
document and because it also speaks the truth about the HTML namespace: 
It is the same as the XHTML namespace. So, in HTML5, 
'xmlns="http://www.w3.org/1999/xhtml"' doesn't have any effect - it is 
just permitted. Hence, this should neither be interpreted as if HTML5 
supports XML namespaces. Nor should it be interpreted as if the XHTML 
syntax was loosend up. Nor should it be interpreted as if the HTML5 
validator has a bug. ;-)

Note: HTML5 isn't ready yet. There are some proposals about permitting 
(some kind of) use of XML namespaces in HTML5 documents. But that issue 
is still debated.
-- 
leif halvard silli

Received on Wednesday, 10 March 2010 12:17:30 UTC