blob: 7029e104b627760660040d9ebca5fe8d99b93418 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
<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 <br> elements correctly. If the test is successful, the text "SUCCESS" should be shown below.
<div id="result">FAILURE</div>
</body>
</html>
|