Mainly in Firefox, although it occasionally breaks in other browsers as well. If you check the jsfiddle below, especially if you go to the last tag and try to delete them all, you can't. Sometimes you can. It's not consistent.
<div id="testDiv" contentEditable="true">
Hey <input id="user-tag-1" class="ut ut-full-name" carpos="9" type="button" tabindex="-1" value="Rob"/>
</div>
I've seen this discussed on Mozilla's board as well as here, the workaround is generally to wrap the non contenteditable html in contenteditable <span>
, <p>
, <span>
. Nothing I have seen actually fixes the problem for me. at least not completely. Even when I can delete the html, there's a lot of strange behavior.
Anyone know why this happens for contenteditable divs, and if it's just something that happens with non contenteditable html, is there a solution that would fix these issues, or do I have to write logic for the backspace and delete keys to check and delete the tags?