问题:
我发现在Chrome和Opera浏览器中存在一种不良行为,当我们删除两个p标签之间的分隔符时,会导致Chrome和Opera删除contenteditable=false元素(widget)和后面的文本。
示例:
html:
<div contenteditable="true" class="editor">
<p>This is the first paragraph.</p>
<p>←Place your cursor here and press backspace. <span class="widget" contenteditable="false">widget</span> Text after widget</p>
</div>
CSS:
.widget{
display: inline-block;
padding: 5px;
background-color: gray;
}
.editor{
font: 20px Trebuchet MS
}
问题:
为什么会出现这个问题?如何修复?