New homepage design of d-p-l.org is now live. <eom>

Michel Fortin michel.fortin at michelf.com
Sat Dec 17 13:06:50 PST 2011


On 2011-12-17 13:09:35 +0000, Stewart Gordon <smjg_1998 at yahoo.com> said:

> Strange.  I don't recall ever seeing <!DOCTYPE html> before HTML5 came along.
> 
> But I am made to wonder why.  What will happen when HTML6 comes out?  
> Or have they decided that validators are just going to update 
> themselves to the new standard rather than keeping separate HTML5/HTML6 
> DTDs (or whatever the HTML5+ equivalent of a DTD is)?

Thing is, if they could have removed the doctype completely they would 
have done so. The doctype doesn't tell anything meaningful to a 
browser, except that today's browser use the presence of a doctype to 
switch between a quirk mode and a standard mode. <!DOCTYPE html> was 
the shortest thing that'd make every browser use standard mode.

The problem was that forcing everyone to specify either one or another 
HTML version is just a exercise in pointlessness. Most people get the 
doctype wrong, either initially or over time when someone updated the 
site to add some new content. If you're interested in validating your 
web page, likely you'll know which version you want to validate against 
and you can tell the validator.

>> Stuff like improperly closed tags or bad entity
>> encoding can break, but that's pretty well independent
>> of doctype validation. That's simply a matter of the
>> document being well-formed.
> 
> No, because in order to determine whether it's well-formed, one must 
> know whether it's meant to be in SGML-based HTML, HTML5 or XHTML.

Perhaps for it matters for validation if you don't say which spec to 
validate against, but validating against a spec doesn't always reflect 
reality either. There is no SGML-based-HTML-compliant parser used by a 
browser out there. Browsers have two parsers: one for HTML and one for 
XML (and sometime the HTML parser behaves slightly differently in quirk 
mode, but that's not part of any spec).

And whether a browser uses the HTML or the XML parser has nothing to do 
with the doctype at the top of the file: it depends on the MIME types 
given in the Content-Type HTTP header or the file extension if it is a 
local file. HTML 5 doesn't change that.

Almost all web pages declared as XHTML out there are actually parsed 
using the HTML parser because they are served with the text/html 
content type and not application/xhtml+xml. A lot of them are not well 
formed XML and wouldn't be viewable anyway if parsed according to their 
doctype.



-- 
Michel Fortin
michel.fortin at michelf.com
http://michelf.com/



More information about the Digitalmars-d-announce mailing list