Test case coming.
Created attachment 21865 [details] reduced test case
This also happens on the Mac (of course, with Cmd+A in place of Ctrl+A).
<rdar://problem/6609509>
*** Bug 24789 has been marked as a duplicate of this bug. ***
*** Bug 25088 has been marked as a duplicate of this bug. ***
My planned approach to just delete everything in the editable root will break a bunch of tests- including the case added for list editing with http://trac.webkit.org/changeset/21648. So I don't think that straightforward approach will work since sometimes a delete is part of a more complex editing action, or its immediately followed by typing.
This was the test I meant to point to: editing/inserting/4875189-1.html
Ugh. This is another area where position normalizing bites us. In this test, delete/replace should leave the LI, but if the whole contents of the DIV is selected (e.g. the range's start is set to div,0 and end is set to div,1), which is what select-all should do, then it should not leave the LI. But with position normalizing, we can't distinguish between those selections at the time of the delete. For reference, here's the contents of editing/inserting/4875189-1.html: <p>This tests for a bug when replacing the contents of a list. The list shouldn't be removed, just its contents.</p> <div contenteditable="true"><ul><li id="li">You shouldn't see this.</li></ul></div> <script> var r = document.createRange(); var li = document.getElementById("li"); r.setStart(li, 0); r.setEnd(li, li.childNodes.length); var selection = window.getSelection(); selection.addRange(r); document.execCommand("InsertHTML", false, "This should be in a list item.") </script>
I thought we had fixed this in: http://trac.webkit.org/changeset/43044 Select All + Delete doesn't delete everything, but a subsequent delete will...