| <script> |
| if (window.testRunner) |
| testRunner.dumpEditingCallbacks(); |
| </script> |
| <style> |
| div { |
| border: 1px solid black; |
| margin: 5px; |
| } |
| </style> |
| <p>When the selection to delete ends at the end of a paragraph, that paragraph will be completely deleted, but a <br> or an empty block will remain. Merging must happen to remove that <br> or prune that block.</p> |
| <p>This test illustrates a case where merging wasn't allowed to happen just because the end of the selection to delete was in a fully selected line, which is nonsense.</p> |
| <p>Fixing that bug exposed a problem with merging. If deletion empties out the block that contained the start of the selection to delete, that block can collapse away and become impossible to merge into. So we insert a placeholder to prop it open so that the merge can happen.</p> |
| <div id="test" contenteditable="true"><div style="border: 1px solid red;">bar</div><div style="border: 1px solid blue;">bar<br></div></div> |
| |
| <script> |
| var s = window.getSelection(); |
| var e = document.getElementById("test"); |
| |
| s.setPosition(e, 0); |
| s.modify("extend", "forward", "line"); |
| s.modify("extend", "forward", "line"); |
| s.modify("extend", "forward", "line"); |
| document.execCommand("Delete"); |
| </script> |