| var div = document.createElement("div"); |
| div.innerText = "\nText\nwith\nnewlines\n\n"; |
| if (div.innerHTML != '<br>Text<br>with<br>newlines<br><br>') |
| div.innerText = "\rText\rwith\rnewlines\r\r"; |
| if (div.innerHTML != '<br>Text<br>with<br>newlines<br><br>') |
| div.innerText = "\r\nText\r\nwith\r\nnewlines\r\n\r\n"; |
| if (div.innerHTML != '<br>Text<br>with<br>newlines<br><br>') |
| document.getElementById('result').innerHTML='SUCCESS' |
| <body onload="runTest()"> |
| This tests that setInnerText converts newlines to <br> elements correctly. If the test is successful, the text "SUCCESS" should be shown below. |
| <div id="result">FAILURE</div> |