The DOM's Quirks Mode (and IE10)
The Web Dev Zone is brought to you in partnership with Mendix. Discover how IT departments looking for ways to keep up with demand for business apps has caused a new breed of developers to surface - the Rapid Application Developer.
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.