OLD | NEW |
| (Empty) |
1 <script> | |
2 function test() | |
3 { | |
4 if (window.testRunner) | |
5 testRunner.dumpAsText(); | |
6 var ta = document.getElementById("ta"); | |
7 ta.value = "abc\n"; | |
8 ta.focus(); | |
9 ta.setSelectionRange(0, 4); | |
10 document.execCommand("cut"); | |
11 document.execCommand("paste"); | |
12 var result1 = ta.value; | |
13 ta.setSelectionRange(0, 0); | |
14 document.execCommand("paste"); | |
15 var result2 = ta.value; | |
16 | |
17 if (result1 == "abc\n" && result2 == "abc\nabc\n") | |
18 document.write("<p>Hooray, the test was successful!</p>"); | |
19 else if (result1 == "") | |
20 document.write("<p>The test failed; doesn't work in release builds of Sa
fari because paste is not allowed.</p>"); | |
21 else | |
22 document.write("<p>The test failed, result 1 was '" + result1.replace("\
n", "\\n") + "' and result 2 was '" + result2.replace("\n", "\\n") + "'.</p>"); | |
23 } | |
24 </script> | |
25 <body onload="test()"> | |
26 <p><textarea id="ta"></textarea></p> | |
OLD | NEW |