Remember the whole crazy Internet Explorer 8 meta http-equiv hub-bub, yesterday? There was one post in all of that mess that was really, really, important.
To sum it up: Internet Explorer 8 will support DOCTYPE switching for new DOCTYPEs (like HTML5).
“Steve“: Are there any doctypes that do not require this new meta tag to render with the IE8 rendering engine?
Chris Wilson: @Steve – sure. Any unknown (i.e. not widely deployed) DOCTYPE. HTML5, for example.
This really does change any frustration that someone should have concerning the new meta tag. This means that you can write your web pages in a completely standards-based way (CSS, HTML5, JavaScript) and not have to use a single browser-centric tag in order to do so.
For those of you who aren’t familiar with the HTML5 DOCTYPE, it looks like this:
<!DOCTYPE html>
You’ll note that it’s significantly simpler than most DOCTYPEs that you’ve seen – and that was intentional. A lot has changed in HTML5 in an attempt to make it even easier to develop a standards-based web page, and it should really pay off in the end.
What’s nice about this new DOCTYPE, especially, is that all current browsers (IE, FF, Opera, Safari) will look at it and switch the content into standards mode – even though they don’t implement HTML5. This means that you could start writing your web pages using HTML5 today and have them last for a very, very, long time.
If nothing else, this should be a good excuse to look through the changes in HTML5 and familiarize yourself with what’s in the pipeline for browsers – Internet Explorer included.
I really, really, wish this was made clear yesterday – it would’ve avoided a whole lot of pain and suffering on the part of the Microsoft Task Force of WaSP and of the Internet Explorer team as a whole. I’m really glad that this is happening, though – the future of standards-based web development still looks quite bright.
Hamish M (January 23, 2008 at 10:56 am)
Well now, this does change things quite a bit. Thanks for bringing it into the limelight John.
Cloudream (January 23, 2008 at 11:01 am)
A nice way, but how IE6 and IE7 treat the HTML5 doctype?
John Resig (January 23, 2008 at 11:14 am)
@Cloudream: As I mentioned, it simply puts the document into standards mode. IE6 and IE7 will ignore the new HTML 5 features (along with Firefox, etc.) but at the very least you’ll be able to develop in your existing standards-based way, looking towards the future.
J (January 23, 2008 at 11:50 am)
Hmm, 2 thoughts
Will IE8 support HTML5 (and how much?)
Will WASP be putting this meta-tag into the source of the Acid Test? If not, how on earth can IE8 be Acid Compliant, as without the tag the page won’t render in IE8?
Robin (January 23, 2008 at 12:22 pm)
IE8 doesn’t currently pass the Acid2 test, and won’t do unless changes are made to either the test or the server it resides on.
James Bennett (January 23, 2008 at 12:34 pm)
John, per Henri Sivonen’s encyclopedic list of DOCTYPEs and browsers (http://hsivonen.iki.fi/doctype/), the HTML5 DOCTYPE actually triggers “almost standards” mode in IE6 and IE7; this means that going forward the IE team is actually breaking their stated goal of backwards compatibility (since having a DOCTYPE that used to trigger “almost standards” now trigger standards will be a regression from some people’s POV).
John Resig (January 23, 2008 at 12:48 pm)
@James: Thanks for that resource, that’s quite handy! It’s important to point out, though, that based upon the definition of “standards mode” vs “almost standards mode” the best that IE implements is “almost standards mode” – thus this really is the best situation that we can hope for (in that there is no other DOCTYPE that pushes IE into a more-compliant mode). Thus, using the HTML5 DOCTYPE we’ll have the most compliant mode of Firefox, Safari, Opera, IE6, IE7, and IE8 all at the same time – sounds like a good situation to me.
Jonathan Kemp (January 23, 2008 at 12:53 pm)
Very good catch on this John. I believe the reason they didn’t point that out is because it totally negates what they are trying to do with version targeting in the first place. Plus, what happens when the HTML 5 DOCTYPE becomes widely deployed? Will it too be included then?
Daniel Pihlström (January 23, 2008 at 2:06 pm)
Johnathan, seeing as how the version targeting is to avoid breaking current sites, it shouldn’t be an issue if it becomes widely deployed after ie8’s release.
I suppose the issue will arise if it’s widely deployed by the release of ie9 and they continue with the x-ua-thingy, you’ll get stuck with your ie8 locked pages.
Jörn Zaefferer (January 23, 2008 at 2:58 pm)
Wow, being able to type a standard-compliant html document without first having to google for the DOCTYPE line makes things significantly easier. Way to go!
Robert Nyman (January 23, 2008 at 3:21 pm)
Wow, this does change things. It’s not like everything’s fine and let’s just move on, but at least it offers an alternative.
Neal G (January 23, 2008 at 5:15 pm)
Now we just need browser vendors to support HTML 5. Hopefully soon!
John Resig (January 23, 2008 at 5:58 pm)
@Neal: Actually, the browsers don’t have to support HTML 5 in order to make it happen. Here’s a quick overview that I made on Snook’s blog:
David Naylor (January 23, 2008 at 6:37 pm)
Cool! This will be the way to go then.
Anup (January 23, 2008 at 7:11 pm)
A comment made here http://intertwingly.net/blog/2008/01/22/Best-Standards-Support#c1201006277 makes the very interesting point that “if you want CSS rules to apply to unknown elements in IE, you just have to do document.createElement(elementName). This somehow lets the CSS engine know that elements with that name exist.”
I have not tried this myself, but I am hoping this means you get HTML 5 in IE 7 and 6 (and 8?) and the q element!
Also, I hope this means that you can serve an HTML5 document, then our favorite JavaScript frameworks(!) will detect IE and do a few createElements for all the new HTML5 elements, and “somehow” CSS targeting all instances of such elements will get applied!
pd (January 24, 2008 at 6:00 am)
I’m almost sure I mentioned something like this in one of my many comments on this matter yesterday. Nuts to me not getting a tiny ego boost, LOL.
On the other hand, John aren’t you now suggesting that we code for a draft recommendation, since HTML5 as a standard doesn’t yet exist? How on earth are we supposed to validate our code and therefore remain standards compliant with the actual standards that already exist by using the DOCTYPE you suggest, “today”?
I currently author all my sites looking for a big fat green tick icon, every time a page loads, meaning HTML Validator has verified my pages against the finite standard specified in the DOCTYPE.
Taking your suggesting to start coding against a recommendation, I get a white cross in a red icon and this:
line 1 column 14 - Error: no internal or external document type declaration subset; will parse without validation
What can I say, I lurv my green tick icon! Incidentally your blog fails in this respect. So much for practice what we preach? :P
HTML Validator uses an algorithm that is the same as that employed by the online W3C validator, according to the extension’s author. Therefore it’s unlikely to be an extension error.
Your suggestion seems to also imply that browsers don’t care which actual standard we write our code in; that they will render the code in standards mode as opposed to quirks but not, for example, in a XHTML1.0 mode? Is this the ‘tag soup’ factor I am hear about every now and then? Perhaps. However it seems to me you are almost encouraging hacks by suggesting that it doesn’t matter what existing or potential specific standard we code for, so long as the browser is tripped into standards mode.
Overall I agree that this might be the cold water we need on the META IE8 drama of yesterday.
Henri Sivonen (January 24, 2008 at 6:12 am)
@pd: There is an experimental HTML5 validator. It has a Web service API that could be used by browser extensions.
Toe (January 24, 2008 at 7:52 am)
Another of Chris Wilson’s comments implied that this would also be the case with XHTML sent with an XML mimetype. This would more or less address pd’s concern about HTML5 still being in draft stage, as XHTML 1.x has been a final standard for quite some time now.
I’m still not big on the meta tag idea, but at least we have an alternative.
Lars Gunther (January 24, 2008 at 9:52 am)
I tried make a flow chart as this needs to be explained to my students. Can anyone look at this: http://gunther.ne.keryx.se/ie8-metatag.svg (or if your browser can’t render the SVG, my Win Firefox can’t, on Linux it renders fine) http://gunther.ne.keryx.se/ie8-metatag.png
I threw it together with Dia in a haste. Here is the source: http://gunther.ne.keryx.se/ie8-metatag.dia
Toe (January 24, 2008 at 1:13 pm)
Lars: Is it certain that any unknown doctype will trigger super standards mode? (And I assume you mean ‘absent’ there.)
Lars Gunther (January 24, 2008 at 1:35 pm)
@Toe:
As long as MS not has committed in writing to anything, using clear and unambiguos words, nothing is certain as I see it.
I will correct the spelling tomorrow. I am Swedish after all.
BTW, now I am using a Vista machine borrowed from a friend and the SVG renders perfectly in FFox.
Keith Bowes (January 24, 2008 at 2:15 pm)
That’s good to hear. So, IE8 will only have this meta-tag thing if you use HTML4? I think if IE does apply standards mode to XHTML without the tag, it should be XHTML 1.1 only, because XHTML 1.0 is basically HTML4 with fewer quirks and complexities (due to being an application of XML rather than of SGML). But it would be good if IE would actually support application/xhtml+xml, though I’m not really sure where XHTML is going in the light of the HTML5 WG.
Jeff Schiller (January 24, 2008 at 3:19 pm)
Lars,
Your SVG diagram is exactly how I understand things at the current time (pending any clarifications from Microsoft, of course). Correct “Abscent” to “Absent”. Also, you could clarify what the DOCTYPE has to be to get to “Standards mode triggering”. My understanding is that it would be a HTML 4.01 DOCTYPE like the “STRICT” one.
By the way, there is a bug in Firefox 2 where it won’t display locally saved SVG files (but it will display SVG files from a web server just fine). Firefox 3 has corrected this problem in my experience. Perhaps this is your problem?
Regards,
Jeff
Peter Kasting (January 24, 2008 at 3:57 pm)
Warning: writing pages in HTML5 _now_ will contribute (down the road) to a similar problem happening — a widely deployed doctype with people depending on quirks of browsers from long ago. If people write in HTML5 and then make sure their pages work on not-yet-HTML5-compliant web browsers (all of them), in several years Microsoft will freeze HTML5 rendering at the IE8 (or 9, or whatever) level to avoid changing these pages’ behavior.
So I suggest not writing to HTML5 until it has progressed at least a little further (more support in Firefox and Safari, etc.).
Michael Zed (January 24, 2008 at 5:11 pm)
Lars Gunther, the server’s HTTP header should normally override the meta tag, but it has been stated that in this case the meta tag has precedence. I think this still awaits official clarification.
Peter Kasting, it’s impossible for anyone, including Microsoft, to say what they will do in a few years. I suspect that this whole idea of maintaining two rendering engines—including their security issues and complex interactions with Javascript, the DOM, and each other—is far from universally popular within the company, and will become a huge burden for the MSIE team. They’ll be working hard to encourage web developers to support their new rendering engine (i.e., to write for web standards), and to find some way past this situation.
Nicolas Mendosza (January 24, 2008 at 7:39 pm)
How does it handle html 6?
kL (January 25, 2008 at 5:32 am)
But IE7 bugs are still immortalized :(
And what about after IE8? Will HTML5 get frozen in IE8-bugmode?
Lars Gunther (January 25, 2008 at 10:22 am)
If anyone still cares, I’ve made access to my SVG slightly more user friendly at http://gunther.ne.keryx.se/ie8-metatag.html
I’ll move it shortly, but I’ll redirect when I do.
I am going to check Bugzilla as to why it is not working in some FFox installs…
Thanks for feedback both here and through the mail.
Nathan (January 25, 2008 at 10:51 am)
From everything I read about html5, the idea is to advance without breaking any existing code. I don’t see how starting to code in html5 will cause the same issues in the future, as html5 is based on the current best practices plus a little extra.
Am I wrong about this?
Kyle Weems (January 25, 2008 at 2:35 pm)
The only immediate drawback I’m seeing about using the HTML5 doctype is that it causes w3c validation to fail. So although I can understand people’s objections to the new meta tag (and like the idea of using the HTML5 doctype), can anyone suggest a way to sidestep the need of adding the meta tag while still being able to pass validation? Perhaps a different doctype?
Lars Gunther (January 25, 2008 at 3:23 pm)
Instead of W3C validation, HTML 5 should be checked with a conformance checker. Look at http://validator.nu/
The background is available at: http://hsivonen.iki.fi/thesis/html5-conformance-checker
Tino Zijdel (February 11, 2008 at 6:19 pm)
I think it would be premature and even harmful to start using the HTML5 doctype right now way before browsers even have any significant HTML5 support. Eventually this may lead to a situation where MS is forced to ‘freeze’ the HTML5 DTD into IE8 ‘mode’ when IE starts implementing HTML5 that might start breaking pages as well…
http://crisp.tweakblogs.net/blog/434/using-the-html5-doctype-prematurely-considered-harmful.html
Thierry Koblentz (March 31, 2008 at 4:27 pm)
@Anup:
Great find!
document.createElement('abbr')
seems to “fix” IE lt 7
Thierry Koblentz (April 7, 2008 at 1:53 pm)
For anyone interested in the ABBR fix, here is a test page:
http://tjkdesign.com/lab/abbr.asp