Bad habits from XHTML (to unlearn)

With the impending completion of the HTML5 spec, I thought I’d summarize the major differences between XHTML and HTML5 that affect me the most in my daily blogging and web development. Figured this might be useful to others.

Void elements (those that cannot contain text or other elements, and thus don’t require an end tag) don’t need to be closed with a nitpicky trailing slash (see: There are only 10 legal XHTML empty tags for more)

5 Comments

The thing is that XHTML was strict purely for the sake of masochism (riding the coattails of XML). The spec was developed with little or no input from actual browser vendors, while laboring under the assumption that a stricter spec would benefit them.

What it didn’t take into much consideration is that the producers of [X]HTML (aka us) rarely check for validity, and the browser vendors, knowing this, still have to produce a product that results in a positive output.

The truth is, you probably never grew fond of serving up XHTML content with the application/xhtml+xml mime type (as Internet Explorer never supported it) or enjoyed the joys of draconian error handling. Which means that, all along, from a web browser’s perspective, you’ve just been producing really funky HTML.

So really HTML5 is awesome, as it says, “What you are doing is ok, because you’ve been doing it. Let’s move forward.”

Agreed, I’m tending more to the school-of-thought that says, if the code is standards compliant, then screw the browser (I say that with my utter bias against IE). I’m more Firefox, though Chrome is starting to make an impact too…

XHTML vs HTML5 reminds me a lot of my feelings during college about studying Engish vs Linguistics. English was a prescriptive field, singularly concerned with enforcing the “right way to do things” all the while turning a blind eye to the forces of language change. Linguistics on the other hand was a descriptive field, concerned with describing the way people do things and realizing that underlying it all are some consistent rules to be discerned.

I’m not trying to say HTML is a natural language, but given it’s produced by gazillions of individuals, CMSs, companies, tools, etc., it starts to take on the aura of a natural language: change happens bottom up instead of top down, people make creative assumptions about what they can and cannot do (like leaving out the tbody element). And if it works in the browser then it’s right.

Another way to put it: worse is better. And oh yeah, I ended up majoring in Linguistics.