Code that breaks Internet Explorer

Published on June 21, 2012

Code that breaks Internet Explorer

    A demo page with an unclosed <form> kills Internet Explorer 7/8/9/10 with varying degrees of fatality.

    Interestingly, three years ago this example for IE 7/8 was discussed on MSDN , but came to the conclusion that there is no bug. Since then, IE 9 and IE 10 (early beta) have come out, which loop in exactly the same way. They say that the latest build of IE 10 is already behaving normally.

    Code
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
       "http://www.w3.org/TR/html4/loose.dtd">
    <style type="text/css">
        #a { margin: 0 10px 10px; }
        #b { width: 100%; }
    </style>
    <table>
        <tr>
            <td>
                <div id="a">
                   <form id="b">
                   <input type="text" name="test"/>
                </div>
            </td>
            <td width="1">
            </td>
        </tr>
    </table>

    If you remove the second td, then IE9 will not fall.