| OLD | NEW |
| 1 <!DOCTYPE html> |
| 2 <script src="../../resources/testharness.js"></script> |
| 3 <script src="../../resources/testharnessreport.js"></script> |
| 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> | 4 <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> | 5 <textarea id="textarea"></textarea> |
| 6 <div id="log"></div> |
| 3 <script> | 7 <script> |
| 4 if (window.testRunner) | |
| 5 window.testRunner.dumpAsText(); | |
| 6 textarea = document.getElementById("textarea"); | 8 textarea = document.getElementById("textarea"); |
| 7 textarea.setSelectionRange(0, 0); | 9 textarea.setSelectionRange(0, 0); |
| 8 textarea.parentNode.removeChild(textarea); | 10 textarea.parentNode.removeChild(textarea); |
| 9 if (window.getSelection().type == 'Caret' && | 11 test(function() { |
| 10 window.getSelection().getRangeAt(0).startContainer == document.body && | 12 assert_equals(window.getSelection().type, 'Caret'); |
| 11 window.getSelection().getRangeAt(0).startOffset == 2) | 13 assert_equals(window.getSelection().getRangeAt(0).startContainer, document.b
ody); |
| 12 alert("SUCCESS: Selection is set to position 2 of BODY.") | 14 assert_equals(window.getSelection().getRangeAt(0).startOffset, 2); |
| 13 else | 15 }); |
| 14 alert("FAILURE: The selection is not set correctly after textarea was delete
d.") | |
| 15 </script> | 16 </script> |
| OLD | NEW |