听说HTML 5.0已经有一段时间了,但是并不知道它到底做了什么改进,这两天就看了下Specification,发现了下面一段话:
The markup snippet at the top of
this section
would be turned into the following DOM tree:
才发现在两个节点中插入一个#text节点是HTML5.0的标准,并不是只针对Table的特殊情况。先BS一下自己孤陋寡闻,继续努力!
由于Firefox 3.5支持HTML5.0,就写了一个简单的程序进行测试,验证了一下:
<input type="button" value="test" onClick="testP()">
<script language="javascript"><!--
function testP(){
alert(document.body.firstChild.nodeName);//#text
alert(document.getElementById('div1').firstChild.nodeName); //#text
}
// --></script>
</body>
</html>