OLD | NEW |
1 <p>This tests to make sure that a selection inside a textarea is updated when th
e textarea is removed from the document.</p> | 1 <p>This tests to make sure that a selection inside a textarea is updated when th
e textarea is removed from the document.</p> |
2 <textarea id="textarea"></textarea> | 2 <textarea id="textarea"></textarea> |
3 <script> | 3 <script> |
4 if (window.testRunner) | 4 if (window.testRunner) |
5 window.testRunner.dumpAsText(); | 5 window.testRunner.dumpAsText(); |
6 textarea = document.getElementById("textarea"); | 6 textarea = document.getElementById("textarea"); |
7 textarea.setSelectionRange(0, 0); | 7 textarea.focus(); |
8 textarea.parentNode.removeChild(textarea); | 8 textarea.parentNode.removeChild(textarea); |
9 if (window.getSelection().type == 'Caret' && | 9 if (window.getSelection().type == 'Caret' && |
10 window.getSelection().getRangeAt(0).startContainer == document.body && | 10 window.getSelection().getRangeAt(0).startContainer == document.body && |
11 window.getSelection().getRangeAt(0).startOffset == 2) | 11 window.getSelection().getRangeAt(0).startOffset == 2) |
12 alert("SUCCESS: Selection is set to position 2 of BODY.") | 12 alert("SUCCESS: Selection is set to position 2 of BODY.") |
13 else | 13 else |
14 alert("FAILURE: The selection is not set correctly after textarea was delete
d.") | 14 alert("FAILURE: The selection is not set correctly after textarea was delete
d.") |
15 </script> | 15 </script> |
OLD | NEW |