Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / editing / deleting / merge-endOfParagraph.html
blobf363591617efdec994fd4c6732f359f2856135a6
1 <script>
2 if (window.testRunner)
3 testRunner.dumpEditingCallbacks();
4 </script>
5 <style>
6 div {
7 border: 1px solid black;
8 margin: 5px;
10 </style>
11 <p>When the selection to delete ends at the end of a paragraph, that paragraph will be completely deleted, but a &lt;br&gt; or an empty block will remain. Merging must happen to remove that &lt;br&gt; or prune that block.</p>
12 <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>
13 <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>
14 <div id="test" contenteditable="true"><div style="border: 1px solid red;">bar</div><div style="border: 1px solid blue;">bar<br></div></div>
16 <script>
17 var s = window.getSelection();
18 var e = document.getElementById("test");
20 s.collapse(e, 0);
21 s.modify("extend", "forward", "line");
22 s.modify("extend", "forward", "line");
23 s.modify("extend", "forward", "line");
24 document.execCommand("Delete");
25 </script>