Is it irresponsible to advocate using HTML5 before it is ready?
A number of renowned HTML5 supporters are advocating the use of HTML5 to the general public while the spec is still in development, unproven, and subject to change. Is this in the best interest of Web site creators or simply irresponsible behaviour?
If HTML5 works in the browsers, does it mean it's ready to go?
The major browser vendors are developing HTML5. So it should not come as a complete surprise that the only criterion for determining if HTML5 can be used by the general public is if Web browsers can gracefully render HTML5 documents. In addition, there is high demand by Web site creators to have new features offered by HTML5, so it would seem to make sense to give the people what they want as soon as possible. But what if some widely used authoring tools will mangle HTML5 documents?
The HTML5 manglers
Probably the most popular authoring tool, built into many HTML editors, is HTML Tidy. Some use HTML Tidy directly before publishing a document. Some use HTML Tidy indirectly and don't even know they are using it, because its use is hidden by the content management system. In some cases, HTML Tidy is used as a batch process on documents that have been published for some time.
So let's take a look what HTML5 supporters advocate and see how the result of using HTML Tidy with HTML5 will produce mangled results.
The following advice regarding the use of HTML5 DOCTYPE is paraphrased to protect the identity of the supporter of HTML5: "You can use HTML5 now by simply switching to <!DOCTYPE html> document type identifier." On the basis of that advice, let's look at what HTML Tidy would do with the following valid HTML5 document:
<!DOCTYPE html><title>Test</title><p>Hello World!</p>
HTML Tidy will convert the HTML5 document identifier into an HTML 3.2 identifier:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2//EN"><html><head><meta name="generator" content="HTML Tidy for Windows (vers 25 March 2009), see www.w3.org"><title>Test</title></head><body><p>Hello World!</p></body></html>
The following assurance regarding the use of nesting block level elements inside the <a> element is paraphrased to protect the identity of the supporter of HTML5: "if you need to put an <a> element around a <div> element, use HTML5 and move on". On the basis of that advice, let's see what HTML Tidy will do to the following valid HTML5 document:
<!DOCTYPE html><title>Greetings</title><a id="abc"><div>Hello World!</div></a>
HTML Tidy will move the <div> element outside the <a> element because according to the current rules of HTML, the <a> element cannot contain block level elements such as <div>. The result will be:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><meta name="generator" content="HTML Tidy for Windows (vers 25 March 2009), see www.w3.org"><title>Greetings</title></head><body><a id="abc" name="abc"></a><div>Hello World!</div></body></html>
If the <a> element in the previous example is used as a hyperlink like this:
<!DOCTYPE html><title>Greetings</title><a href="http://localhost"><div>Hello World!</div></a>
HTML Tidy will move the <div> out of the hyperlink thus creating an empty hyperlink which is unusable in Web browsers:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><meta name="generator" content="HTML Tidy for Windows (vers 25 March 2009), see www.w3.org"><title>Greetings</title></head><body><a href="http://localhost"></a><div>Hello World!</div></body></html>
The next assurance (also paraphrased to protect the identity of another HTML5 supporter) is as follows: "of course, HTML5 can be used now". S/he then goes on to provide examples of how to use the following new HTML5 elements: <header>, <footer>, <nav>, <aside>, <article>, <figure>, <section> and <article>. Again, let's start with the following valid HTML5 document:
<!DOCTYPE html><title>Greetings</title><header>Hello World!</header>
This time, HTML Tidy will throw the following error and will not be able to proceed:
- line 3 column 1 - Error: <header> is not recognized!
- line 3 column 1 - Warning: discarding unexpected <header>
- line 3 column 9 - Warning: plain text isn't allowed in <head> elements
- line 2 column 1 - Info: <head> previously mentioned
- line 3 column 9 - Warning: inserting implicit <body>
- line 3 column 21 - Warning: discarding unexpected </header>
- Info: Document content looks like HTML 3.2
- 4 warnings, 1 error were found!
- This document has errors that must be fixed before using HTML Tidy to generate a tidied up version.
And it's not only HTML Tidy that mangles HTML5. Let's take the following valid HTML5 snippet example and run it through three popular WYSIWYG editors:
<a id="abc"><div>Hello World!</div></a>
XStandard will remove the <div> and enclose the <a> element in a paragraph:
<p><a id="abc">Hello World!</a></p>
CKEditor running in Firefox will create an empty paragraph and move the <a> element inside the <div>:
<p></p><div><a id="abc">Hello World!</a></div>
TinyMCE running in Internet Explorer will permit a <div> inside the <a> element but will create invalid HTML (all versions) by placing the <div> element inside a paragraph:
<p><a id="abc"><div>Hello World!</div></a></p>
And there are plenty of other examples of HTML5 being mangled. For example, if you start with this:
<header><p>blah</p></header>
One editor will produce:
<p><header></header></p><p>blah</p>
And another editor will produce:
<p>blah</p>
The problem is not with authoring tools. Authoring tools were written to support the rules of HTML. The problem is that HTML5 has changed the rules of HTML, and this stems from the fact that HTML5 is developed by only one group of stakeholders in Web technology - browser vendors. As a result, the needs and concerns of other stakeholders of Web technology are not being addressed. Yet influential HTML5 supporters, for various reasons, are disregarding these shortcomings, and are encouraging public use of HTML5 even before it is ready.
Should HTML5 come with a warning label?
The way HTML5 is being sold/advocated reminds me of how the tobacco industry in its early days used to market cigarettes - by claiming that they are safe to smoke. Today cigarette packages come with safety warning labels. Perhaps HTML5 should come with a warning label similar to those found on cigarette packages today?

Yes - advocating premature use of HTML5 is irresponsible
Web pages can start their lifecycle being written by hand then some time later they can be edited using authoring tools, which can mangle HTML5 markup and possibly delete content. To the supporters of HTML5 who advocate premature use of HTML5, I say that even if you have good intentions, please apply a broader view of how HTML is used and be mindful of the influence you have on novice Web site creators.
Comments are closed for this article.