<html>
<head>
    <script>
    function runTest() {
        if (window.testRunner)
            testRunner.dumpAsText()

        var div = document.createElement("div");
        div.innerText = "\nText\nwith\nnewlines\n\n";

        alert(div.innerHTML)
        if (div.innerHTML != '<br>Text<br>with<br>newlines<br><br>')
            return;
            
        div.innerText = "\rText\rwith\rnewlines\r\r";

        if (div.innerHTML != '<br>Text<br>with<br>newlines<br><br>')
            return;

        div.innerText = "\r\nText\r\nwith\r\nnewlines\r\n\r\n";

        if (div.innerHTML != '<br>Text<br>with<br>newlines<br><br>')
            return;
            
        document.getElementById('result').innerHTML='SUCCESS'
    }
    </script>
</head>
<body onload="runTest()">
    This tests that setInnerText converts newlines to &lt;br&gt; elements correctly. If the test is successful, the text "SUCCESS" should be shown below.
    <div id="result">FAILURE</div>
</body>
</html>
