Internet Explorer 9 standards document mode enables the same markup and same script
to work across browsers. You should use Internet Explorer 9 standards document mode
to take advantage of new features in the
ECMAScript, Fifth Edition standard (ES5) and IE9’s
enhanced DOM programmability. However, to maintain fidelity with older
standards mode, and IE8 standards mode differs somewhat from IE9 standards mode.
You can use these compatibility modes and the F12 developer tools to migrate your
site to use the new ES5 features on your own schedule, while your site continues
to run in IE9.
In two blog posts –
Testing sites with Browser Mode vs. Doc Mode and
IE’s Compatibility Features for Site Developers – Marc Silbey explains
how to take advantage of document modes in Internet Explorer 9. He also discusses
how to use Browser Mode and Document Mode to test sites for IE9 and previous IE
versions. In this post, we’ll explore what developers need to know about how the
in a previous post, you (the developer) control the document mode that IE
will use when rendering your site by using the DOCTYPE and X-UA-Compatible Meta
how to set the document mode, see our post on
IE’s Compatibility Features for Site Developers and the
Determining Document Mode diagram for IE9.
three examples of code that, due to our conformance to the ES5 standard, provide
different results depending upon the document mode. For additional compatibility
Compatibility Cookbook on MSDN, the blog post
Enhanced Scripting in IE9: ECMAScript 5 Support and More, the
ES3 Standards Support document, and the
Microsoft JScript extensions to the ES3 standard.
Arguments.caller is not supported in IE9 standards document mode, per ES5 section
10.6. Consequently, Quirks, Internet Explorer 7 standards, and Internet Explorer
8 standards document modes in IE9 alert “1” for the following code. Internet Explorer
9 standards mode issues the script error "Unable to get value of the property 'length': object is null or undefined."
The ES5 standard requires that indirect evals—invocations of eval() by using a name
other than “eval”—resolve to a global scope rather than a local scope. To support
compatibility with previous versions of IE, Quirks, IE7, and IE8 doc modes maintain
a local scope for indirect evals, while IE9 standards mode interprets them according
to the global scope.
In IE8 and IE9, indexed properties can be added to string objects. With IE8 you
can create these properties for all indexes regardless of the length of the string
object. In IE9 you can create indexed properties, but only for indexes that are
greater than the length of the string. IE9 will also give you indexed access to
the string itself. In the example below, we create a String object and then attempt
to define values for array indices of that object. IE8 and the IE9 compatibility
document modes allow us to create an array object with the same variable name as
a string object; IE9 standards mode does not. As a result, in IE9 standards mode,
the function returns “H-e-l-l-o- -W-o-r-l-d.” In the other document modes, the function
As you migrate your site to IE9 standards doc mode, you may find that some of your
script behaves differently than in Internet Explorer 8. The F12 developer tools
in Internet Explorer 9 enable you to test your scripts in the four document modes.
Changing the Document Mode through IE’s F12 developer tools refreshes the page and
document mode. You can use these document modes to help debug your scripts
as you migrate your code to IE9 standards mode.
We have made every effort to ensure that IE9’s compatibility document modes support
the same functionality that we shipped for these modes in IE8. However, because
the Chakra engine is not the same as we shipped in IE8, it is bound to have some
differences. The Internet
Explorer 9 Compatibility Cookbook explains some of these key differences.
Briefly the following are affected:
If you encounter additional compatibility issues, we’d like to hear about them.
Please send us your feedback via Connect.
We’d also like to point you to some blog posts and IE Test Drive demos that we have
created to explain or showcase the new functionality that Chakra introduces, and
some differences from IE8.
In summary, IE9 supports different ECMAScript standards and extensions in different
document modes. The new IE9 document mode allows you to take advantage of new ES5
features according to your schedule. We hope you find the F12 developer tools useful
as you debug your code and migrate to the ES5 and HTML5 features supported in IE9