| OLD | NEW |
| 1 <html> | 1 <!doctype html> |
| 2 <head> | 2 <script src="../../resources/testharness.js"></script> |
| 3 <script src="../../resources/testharnessreport.js"></script> |
| 4 <script src="../assert_selection.js"></script> |
| 3 <script> | 5 <script> |
| 4 if (window.testRunner) | 6 test(() => { |
| 5 testRunner.dumpEditingCallbacks(); | 7 assert_selection( |
| 8 '^foo<span>b|ar</span>baz', |
| 9 selection => { |
| 10 const span = selection.document.querySelector('span'); |
| 11 span.parentNode.removeChild(span); |
| 12 selection.document.execCommand('selectAll'); |
| 13 }, |
| 14 '^foobaz|'); |
| 15 }, 'selectAll after node remove'); |
| 6 </script> | 16 </script> |
| 7 | |
| 8 | |
| 9 <script src=../editing.js language="JavaScript" type="text/JavaScript" ></script
> | |
| 10 | |
| 11 <script> | |
| 12 | |
| 13 function runTest() { | |
| 14 var selection = window.getSelection(); | |
| 15 var e = document.getElementById("test"); | |
| 16 var r = document.getElementById("removeme"); | |
| 17 | |
| 18 selection.setBaseAndExtent(e, 0, r.childNodes[0], 2); | |
| 19 | |
| 20 r.parentNode.removeChild(r); | |
| 21 selectAllCommand(); | |
| 22 } | |
| 23 | |
| 24 </script> | |
| 25 | |
| 26 <title>Removing the endpoints of a selection</title> | |
| 27 </head> | |
| 28 <body> | |
| 29 <p>This tests behavior when a node that serves as the start or end of a selectio
n is removed from the document. Ideally, we would just adjust the selection whe
n an endpoint is removed, for now, we just blow away the selection.</p> | |
| 30 <p>This test creates a selection that ends inside of a node that will be removed
. Then the node is removed. Then a Select All is executed. The entire documen
t should be selected.</p> | |
| 31 <div id="test"> | |
| 32 hello <span style="color:red;" id="removeme">removeme</span> world! | |
| 33 </div> | |
| 34 | |
| 35 <script>runTest()</script> | |
| 36 | |
| 37 </body> | |
| 38 </html> | |
| OLD | NEW |