I was reading an interesting post about HTML5 and the failure of XHTML strict parsing recently, and it reminded me of an issue I have with the HTML5 spec.
It really bothers me that the HTML5 spec permits the use of quoteless attribute values (e.g. class=blah
instead of class="blah"
) and a lack of closing slashes in empty tags. I think we can all agree that strict parsing, like with properly-served XHTML, isn’t optimal. (XML pages are too fragile. Especially when you have user-submitted content, it’s all to easy to completely break the page.) But the coding practices encouraged by XHTML make it much easier to parse web pages and to maintain some level of source legibility.
I think the HTML5 specification should incorporate some of XHTML’s requirements, while dropping the strict parsing. Let’s have quoted attributes and slash-terminated <img />
and <br />
tags. Anything else is sloppy and all too reminiscent of the Geocities days.
Anyone aiming for some level of professionalism in their work should continue with current XHTML-style coding practices and apply them to HTML5 when it comes time for that.
In the words of Tantek Çelik:
I’m going to continue coding my HTML5 with quoted attributes, explicit closing tags, and self-closing empty elements, making them what I call “bi-glot” documents: both HTML5, and valid XML.
I’ve given up on “proper” XHTML (by any definition). Long Live XML-valid HTML5.