我遇到了Chrome 45版的问题.
问题: 当我尝试使用JavaScript删除最后一个子div时,Chrome引擎会隐藏父div中的所有其他标记(span和b标记将被隐藏):
<div class='parentDiv' id='pdiv'>
Some text <span style='color:red;'>BBBBBBBBBBBBBBBBBBBBBBB</span> more example text more example <b style="color:green;">more</b> example text more example more example text more example more example text more example more example text example text example text example text example text example text example text example text example text example text
<div id='secondChild' style='color:blue;'>
This div should be removed.
</div>
</div>
<span class='Execute' onclick="removChild()"><b>Click me</b></span>
<script type='text/javascript'>
var removChild = function() {
document.getElementById('pdiv').removeChild(document.getElementById('secondChild'))
}
</script>
Run Code Online (Sandbox Code Playgroud)
看起来只有当前的Chrome版本(45)受到影响.Beta和dev频道不受影响.为了测试,我使用了干净的Chrome版本(没有扩展名).此外,我没有在Chromium问题报告列表中找到此问题.
注意:只有当父div内容大于250个字符时才会发生这样的傻瓜. …