The goal of the Windows Internet Explorer team's work on the HTML parser has been for all HTML to parse the same across modern browsers. This is possible because HTML5 is the first version of HTML to fully define HTML parsing rules, down to the last edge case and error condition. Even if your markup is invalid, HTML5 still defines how to parse it, and Internet Explorer 10 follows these rules. The following parsing examples show how some cases are fixed as part of these improvements.
|HTML||Document Object Model (DOM) (HTML5 + Internet Explorer 10)||DOM (Windows Internet Explorer 9)|
These improvements apply to innerHTML as well. Code patterns like the following now work as you would expect in Internet Explorer 10.
var select = document.createElement("select"); select.innerHTML = "<option>one</option><option>two</option>"; var table = document.createElement("table"); table.innerHTML = "<tr><td>one</td><td>two</td></tr>";
HTML5 ensures markup will parse consistently, but developers should still aim to write valid markup from the onset. Writing valid markup means your site works the way you expect and is more compatible with older browsers.
To help developers write consistently valid markup, Internet Explorer 10 now reports HTML parsing errors through the F12 developer tools, as shown in the following screenshot.
Because some features in earlier versions of Internet Explorer aren't compatible with HTML5 parsing, they have been removed from IE10 mode in Internet Explorer 10. Sites that rely on the legacy features in this section will still work when running in legacy compatibility modes. This way, a site that works today will continue to work with Internet Explorer 10 even if the site's developers don't have the time or resources to update it. (For more information about compatibility modes, see Defining Document Compatibility on MSDN.)
You can still use conditional comments such as the one shown here, but they will target only older versions of Internet Explorer. If you need to distinguish between more recent browsers, use feature detection instead.
<!--[if IE]> This content is ignored in Internet Explorer 10 and other browsers. In older versions of Internet Explorer, this renders as part of the page. <![endif]-->
Element behaviors, introduced in Microsoft Internet Explorer 5.5 and shown here, are no longer recognized in Internet Explorer 10 in IE10 mode.
<html xmlns:my> <?import namespace="my" implementation="my.htc"> <my:element> This parses as an unknown element in Internet Explorer 10 and other browsers. In older versions of Internet Explorer, this markup binds to "my.htc". </my:element> </html>
XML data islands, introduced in Microsoft Internet Explorer 5 and shown here, are no longer parsed as XML in Internet Explorer 10 in IE10 mode.
<xml> This parses as <b>HTML</b> in Internet Explorer 10 and other browsers. In older versions of Internet Explorer, it parses as XML. </xml>
- HTML5: Section 8.2