html 5: doctype to version
At a regular pace, there are discussions about the need of versioning for HTML 5. The issue breaks down around a few points including identification of the language itself for different kind of user agents, and parser libraries. A while ago, I had published an overview of different methods to identify the HTML language.
Michael A. Puls II posted an interesting mail about doctype this morning. He's writing
In Opera, goto opera:config#CompatMode%20Override and set the CompatMode Override to 2. This will make Opera always use standards mode for HTML even if there isn't a doctype.
So,
<html>
<head>
<meta charset="utf-8">
<title>HTML5 document</title>
</head>
<body>
<p>This is an HTML5 document.</p>
</body>
</html>
would be rendered in standards mode.
He's warning people saying that:
What you will see is that on some sites, forcing standards mode breaks pages.
But add something interesting to me. (emphasis is mine)
Now, for HTML5 pages specifically, browsers could always force standards mode, but without the HTML5 doctype, there would have to be something like <html version="5">
so browsers would know when to force standards mode. However, <!DOCTYPE html>
already accomplishes that behavior now.
It would help the HTML validators, syntax checkers to identify the intent of the author. It would also make it easier for writing converters. It would also ease people who wants to jump from HTML to XML back and forth.
How would a version attribute make it easier people who want to jump back and forth from HTML and XML?
Hi Sam,
in my mind, getting rid of the doctype is a good step for documents without XML DTD, plus the fact that it might create confusion for people. But indeed, it's not a straightforward improvement.
I wish there was a uniform syntax between the two serializations as well. That would be another step… more difficult this one.
While not widely advertised, the DOCTYPE that HTML5 has provisionally settled on works with XHTML5 too. Take a look at my web log, for example.
HTML was originally intended to be an easy, open, and lasting format for publishing documents on the web. Today, HTML has become a somewhat convoluted hair-pulling platform for building sophisticated web applications - like I build. I wish that HTML could split in two.
One path would present a well-defined application platform that is neither pro or anti any one vendor (such as Microsoft) and is supported and fully embraced equally by all browser vendors. The application platform would provide appropriate constructs for building applications - rather than abusing span, div, and tables to achieve the desired effect.
The second path would return HTML to its roots, allowing it to once again be a simple way to author documents.
Short of that, I would much rather see consistent implementation of the current standards over yet another round of "change" which only creates more issues for years to come until legacy browsers have faded away.
One great thing that HTML 2.0 introduced was a strict versioning system so as to know exactly what standard a document is being written to, and from there enable user agents to derive some hint as to how to display it (e. g. the presence or absence of (!DOCTYPE) to determine whether to put a browser into "quirks mode"). In particular, if you intend to feed a file to a validating engine, that engine needs quite specifically to know exactly which standard it purports to be written to.
And if (!DOCTYPE) is to be reduced to a mere "quirks mode" deselector then it falls to the attribute VERSION of the (HTML) tag to set whether we are dealing with HTML 5, or 6, etc.
Or can we all be that cocksure that there will never be an HTML 6, or even a 5.1?
And for that matter, using an opening tag of (HTML VERSION="5") might make for a far better and more elegant way for IE8 to know when to invoke the fullest weight of standards mode than their proposed (META HTTP-EQUIV="X-UA-Compatible" CONTENT="IE=8") tag. That latter simply sounds too vendor-specific, or are we to look towards introducing similar such vendor-specific tags for each of Mozilla, Firefox, Opera, Safari, and who knows how many other such lesser or newer user agent vendors?