Working with a customer, I was explaining the 3 rendering engines that we have in Internet Explorer 8 (Quirks, IE7 Standards, and IE8 Standards), and how you opt into them. As we went through this, a question came up where I didn’t know the answer: what happens if you have a page whose DOCTYPE specifies Quirks mode, but which hosts an IFrame containing a page whose DOCTYPE specifies standards mode? My search engine mojo may have been inadequate that day, but I couldn’t locate an authoritative answer.

Rather than guess, I figured I would build a test. I wrote the following page, and called it guest.html:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="
http://www.w3.org/1999/xhtml">
    <head>
        <title>guest</title>
        <script type="text/JavaScript" language="JavaScript">
            function bodyOnLoad() {
                if (document.getElementById("casesensitive") != null) {
                    window.alert("IE7-");
                } else {
                    window.alert("IE8+");
                }
            }
        </script>
    </head>
    <body onload="bodyOnLoad()">
        <p>This is the guest</p>
        <div id="caseSensitive"></div>
    </body>
</html>

What I had done was to leverage a change in case sensitivity in JavaScript, which would cause a match when in IE8 standards, or a failure to match in IE7 standards or Quirks. If you launch this page by itself, then it will pick up standards (as long as you’re not on the Local Intranet with the default group policies) and show IE8+. (You can manually set it to Quirks or IE7 using the dev tools to see it change modes.)

Now, let’s host this HTML in an IFrame inside of a page which specifies Quirks Mode:

<html>
    <head>
        <title>Mixed rendering test</title>
    </head>
    <body>
        <p>I am the host</p>
        <iframe src="guest.html"></iframe>
    </body>
</html>

When we run it – what do we find?

IE8+.

So, a standards page inside of an IFrame on a Quirks page still runs in standards. Seeing is believing.