How IE8 Gets Standards Compliant

There has been a big furor among web developers in the last couple of days, following an article published on A List Apart, Beyond DOCTYPE: Web Standards, Forward Compatibility, and IE8. In the article, Aaron Gustafson details a recent endeavor with Microsoft in planning how Internet Explorer 8 will support standardized markup, scripts and styles.

At the time when IE7 was in the works, developers were warned that breaking changes were being made to the way the browser rendered pages, breaking meaning it would be different from the way IE6 works. Now that the IE team at Microsoft are working on the next version of the browser, they want to avoid a similar situation the next time around. There is a posting on the IE Blog covering this subject.

Since version 6, Internet Explorer has employed a technique called the doctype switch. A web page typically has a single specific line of code at the top of the source view, called the doctype, telling the browser which version of HTML was being used. The doctype switch, then, changes the way IE renders pages based on the doctype. An older, incorrect, or incomplete doctype would trigger IE’s quirks mode, which is not perfectly standards-based. A current, correct doctype sends IE into standards mode, where it renders the page as close to the standards as it can. That is relative, of course, as IE6 is very behind on standards support compared to current browsers today. IE7 got better at it, but is still behind.

The IE team wishes to make IE8 as standards compliant as they can get it, but they will need to change IE such that it will work differently than IE 6 or 7. This is where the breaking changes comes in.

To avoid the problem, the IE team wishes to introduce a third mode for IE: super-standards mode. This mode will be even more standards compliant than IE7’s standards mode, which will remain in IE8 as just standards mode. Of course, quirks mode will be left as it is. IE8’s super-standards mode will be moving forwards, the others will be more or less frozen as they were in IE7.

But how to trigger the super standards mode?

This is where it gets interesting.

There already exists the doctype switch to toggle between quirks and standards modes. To get to super-standards mode, the IE team wishes to utilize a meta element in the head of the document. An example of such an element is as follows:

<meta http-equiv="X-UA-Compatible" content="IE=8" />

By default, standards mode in IE8 will be the same as standards mode in IE7. But to get into the forward-moving super-standards mode, the above snippet would need to be present in the page. As Jeremy Keith puts it:

Unless you explicitly declare that you want IE8 to behave as IE8, it will behave as IE7.

Madness, that’s what it is. If IE8 encounters a page with the above snippet, it will kick into super-standards mode. But if the snippet is NOT present, IE8 will render the page in the same way as IE7 would have, even in standards mode.

There have been many postings and comments following the publication of this article. Quite a few of the opinions shown are those of irate developers, seriously annoyed (that’s putting it seriously mildly) at having to include an additional element in each page to gain the benefit of IE8’s super-standards rendering mode. Many others are more balanced and levelheaded, making good points and counterpoints on the ramifications of this technique. It is not an even split – perhaps two thirds against the technique, and the rest for it, or for a variant.

Eric Meyer also published an article on A List Apart, From Switches to Targets: A Standardista’s Journey. He writes of his initial reaction to the proposed technique, and later shows how some of the merits of the technique got him to change his mind. He also wrote a follow-up post on his personal blog.

Speaking for myself, I am on the fence until I know more about the situation. However, I do have some initial observations…

I would hate to be the IE team right now – they are between a rock and a hard place. On one hand, they don’t want to cause any serious breakage of webpages upon release of IE8. And on the other hand, they want to move forward with standards support (and many web developers want this as well). As a web developer, I do wish IE would catch up with the other current browsers and move the web forward. And yet, I can appreciate the need to prevent breaking changes from happening. It seems to be a delicate balancing act.

Using this technique would put pressure on developers to add this bit of markup to their pages (no small task, considering the number of pages out there) so as to get the benefits of the new and better IE8. It makes this an “opt-in” situation, where we would have to explicitly request the super-standards mode. However, doing this does solve the balancing problem – for now.

And it’s only a short-term solution, ultimately. Unless a break of some kind is made at some point, this cycle could well repeat for IE9, and continue into the future. It has to end somewhere.

There is a bit of a smell about how this technique involves adding a little extra markup solely for IE’s benefit. Many commenters seem to be getting hung up on this point. The way I see it, we do similar things with conditional comments, which are IE-only…

There have been multiple suggestions to reverse the technique, by using the meta element to declare that the page should be rendered in “just” standards mode, preserving compatibility with past versions of IE. So any page without the element would automatically get super-standard mode. I think this would be a better way to do it in the long run.

At this point, in my small world, I’m thinking that backwards-compatibility needs to be broken at some point so IE can move forward. And that would ultimately be good for the web as a whole. But again, until more information is made available and weighed, it’s just an interesting and lively debate.

The Web Standards Project website has posted a disclaimer that, although individuals who are members of the project have worked with Microsoft in this venture, said individuals do not represent WaSP in this regard.

Digital Web Magazine is maintaining a list of posts covering the subject – there is quite a bit of reading material covered in all those.