Repro steps: 1. Inside a contentEditable region, select starting inside a table cell, and ending in an inline or block past the table cell. 2. Hit backspace/delete Result: Selected contents are deleted, contents of non-selected part of inline/block are merged into the table cell. Expected Result: Selected contents are deleted, but the table cell boundary is treated like an editable root, and no merge occurs. This is what Word, TextEdit, and Firefox all do (IE has very strange behavior - it doesn't even perform a delete of any sort, and just collapses the selection). webkit only demo (you'll need to hit "eval JS now" button to execute the js that does the select + delete): http://www.plexode.com/cgi-bin/eval3.py#ht=%3Cdiv%20contentEditable%20id%3D'edit'%3E%3Ctable%20id%3D'table'%20border%3D1%3E%3Ctr%3E%3Ctd%3E1%3C%2Ftd%3E%3Ctd%3E2%3C%2Ftd%3E%3C%2Ftr%3E%3Ctr%3E%3Ctd%3E3%3C%2Ftd%3E%3Ctd%20id%3D'cell'%3Elast%20table%20cell%3C%2Ftd%3E%3C%2Ftr%3E%3C%2Ftable%3E%3Cb%20id%3D'inline'%3Einline%20after%20table%3C%2Fb%3E%3C%2Fdiv%3E&ohh=1&ohj=0&jt=edit.focus()%3B%0Avar%20sel%20%3D%20window.getSelection()%3B%0Avar%20rng%20%3D%20sel.getRangeAt(0)%3B%0A%2F%2F%20Select%20starting%20inside%20the%20last%20table%20cell%0Arng.setStart(cell.firstChild%2C%203)%3B%0A%2F%2F%20End%20selection%20inside%20inline%20after%20table%20cell%0Arng.setEnd(inline.firstChild%2C%203)%3B%0Asel.removeAllRanges()%3B%0Asel.addRange(rng)%3B%0A%0A%2F%2F%20Delete%20the%20selected%20contents%0Adocument.execCommand('Delete')&ojh=0&ojj=0&ms=100&oth=0&otj=0&cex=1
This bug is still reproducible in latest trunk. I filed a new spec issue to try to gather some feedback about the expected behavior. https://github.com/w3c/editing/issues/164
It seems we have a regression test precisely to ensure we keep the behavior this bug suggests to change: * editing/deleting/5032066.html "This tests deleting when the caret is at the start of a paragraph just after a table. The content in that paragraph should be moved into the last table cell unless that content is another table. So, I'm not sure whether this is a bug or not. There is no spec about this behavior, to my knowledge, so we should fist agree on the expected behavior.
Created attachment 335185 [details] Test case to reproduce the bug
Attached a new test case for the bug. When trying different browsers, I've got the following results: When I tried on Chrome, - First backspace: removed "T" then move caret before "e" - Second backspace: Move "esting" after "2" When I tried on Edge, - First backspace: removed "T" then move caret after "2" - Second backspace: remove "2" When I tried on Firefox: - First backspace: removed "T" then move caret before "e" - Second backspace: Does nothing