HTML5 Zone is brought to you in partnership with:

John Esposito edits Refcardz at DZone, while writing a dissertation on ancient Greek philosophy and raising two cats. In a previous life he was a database developer and network administrator. John is a DZone Zone Leader and has posted 326 posts at DZone. You can read more from them at their website. View Full User Profile

The DOM's Quirks Mode (and IE10)

12.30.2011
| 3469 views |
  • submit to reddit

It's no secret that IE10 will support web standards far, far better than any previous version of IE. And Microsoft's recent announcement that IE will update automatically should kill as many IE6 and 7 installations as Windows Updates are allowed.

Besides standards support, though, full implementation of the DOM, as specified by W3C, distinguishes three 'modes' a document can have, depending on its doctype (and the relation of the doctype value to modern standards): no-quirks, which means that the document is fully standardized (and the rest is up to the browser); quirks mode, which is a way of indicating that a document contains significant amounts of legacy code; and limited-quirks mode, which lies somewhere in between.

The idea here is that new browser will need to read pages created with an old DOCTYPE, and the HTML parser has to know when to treat legacy documents properly. The same tags may behave differently, depending on which standard the document originally followed; the parser needs to recognize this, and parse the HTML accordingly. (Simplest, most harmless example of an old tag whose behavior is different in HTML5: <i>, which of course originally indicated italics, but now indicates 'an alternate voice or mood'. Which italics can indicate, of course, and usually do, but since the standard doesn't specify this any more, they also may not.)

The fourth IE10 platform preview distinguishes these modes clearly, as a recent announcement on the IEBlog indicated, and as other browsers do. While other browsers parse a page by old HTML standards (when the doctype tells them to), IE10 does a better job of parsing according to old standards and also 'emulating' earlier versions of IE (which have quirks galore).

The first commenter put it cleverly:

Compatible backwards compatibility--nonstandard behaviors only when someone asked for them! Awesome--great step forward for the Web.


If this is too vague, check out the discussion in the comments, which clarifies more precisely what  falls into which quirks-category.

Quirks-mode certainly operation isn't new. (Here's a fuller explanation.) But IE10's support for multiple quirks-modes should make development for the future a little less stressful, especially if Windows 8 and IE10 are as big for Microsoft as some are predicting.