Document Modes and JavaScript Support
I just read a pretty cool article from the MSDN Blogs and basically it speaks to the fact that we, the developers, have complete control of the document mode that IE will use when rendering your code.
By leveraging the right DOCTYPE and the correct X-UA-Compatible Meta tag or HTTP Header, you can force IE9’s new JavaScript engine, Chakra, to use the document mode you specify so that you can know, explicitly, which JavaScript features will be supported. I’ve copied the Chakra’s JavaScript support table from MSDN’s article. For the detailed article, please visit their post on IE’s Compatibility Features for Site Developers and the Determining Document Mode diagram for IE9.
| Document Mode | Description |
|---|---|
| IE9 standards | IE9 standards document mode is the default if a Web page uses a standards-compliant DOCTYPE and doesn’t specify an X-UA-Compatible meta tag. In this mode, IE supports ECMAScript, Fifth Edition features, enhanced DOM programmability, and removes some of the key differences between our IE8 JavaScript implementation and the ECMAScript, Third Edition Specification. |
| IE8 standards | IE8 standards document mode supports the JavaScript additions we made in IE8 to implement portions of the then-draft ES5 standard, such as native JSON support and accessor support on DOM objects. This mode also supports the changes made in IE8 to fix some key issues raised by developers. |
| IE7 standards | IE7 standards document mode supports the JavaScript functionality that was available in IE7, including the Microsoft extensions supported in the IE7 standards mode in IE7 and IE8. |
| Quirks | Quirks mode supports the JavaScript functionality of IE6, and the Quirks mode of IE7 and IE8. |