One of things I’ve been doing lately is reading the HTML 5 spec. Before you tell me to sod off, don’t forger that HTML 5 is here…to stay, I’d say! Yes, there’s still no final version and the RC is only planed for 2012, but the thing is that most browsers are implementing the current drafts right now.
I’m not sure if you recall the story (or should I say legend?) behind the use of DOCTYPE instructions in HTML pages. Here’s a quick recap: while developing IE 5 for Mac, MS noticed that its new version had improved its standard support so much that it broke most (if not all?) existing HTML 4 pages. Yes, version 5 was better than 4 and there was nothing wrong with (to be honest, it got several things wrong, but being closer to the standard wasn’t one of them). Yes, the problem was really with the pages, which were written for a specific browser instead of the existing standard(remember the IE4/Netscape 4 browser war?).
We can all agree that MS couldn’t simply break all the existing pages and expect that its authors fixed them (that would surely had cost them the market leadership). So, they had a “great” idea: new pages should use a DOCTYPE directive as a way to indicate that they should be rendered according the spec. If IE didn’t find it in a page,it would assume the so called quirks mode and it would render the page just like IE 4 did. Well,guess what? All other major browsers reused the idea and the DOCTYPE hell was born. If you think I’m kidding, just take a look at Henri Sivonen article on the DOCTYPE instruction…
Anyway, here’s one of several DOCTYPEs which trigger the standard HTML 4 compliant mode in a modern browser:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
Wtf? Can any of you remember this? I can’t and I’m really scared when I look at Sivonen’s ”>table which shows the variety of DOCTYPEs instructions that might (or might not) trigger the standard compliant mode in the existing browsers…
Thank god the guys behind HTML 5 had simplification as one of their objectives. Now, with HTML 5, you can request the HTML 5 standard mode with this simple DOCTYPE instruction:
How sweet is this? I say it’s great and I *can* really remember this and reuse it in other pages! Thanks guys, I guess I can reduce my daily intake of vitamins
And that’s it. Stay tuned for more.