FireFox对TABLE中各元素的firstChild属性的处理(续)

来源:互联网 发布:java 8中文版实战 编辑:程序博客网 时间:2024/04/30 06:51

听说HTML 5.0已经有一段时间了,但是并不知道它到底做了什么改进,这两天就看了下Specification,发现了下面一段话:

The markup snippet at the top of this section would be turned into the following DOM tree:

  • DOCTYPE: html
  • html
    • head
      • #text: ⏎␣␣
      • title
        • #text: Sample page
      • #text: ⏎␣
    • #text: ⏎␣
    • body
      • #text: ⏎␣␣
      • h1
        • #text: Sample page
      • #text: ⏎␣␣
      • p
        • #text: This is a
        • a href="demo.html"
          • #text: simple
        • #text: sample.
      • #text: ⏎␣␣
      • #comment: this is a comment
      • #text: ⏎␣⏎

才发现在两个节点中插入一个#text节点是HTML5.0的标准,并不是只针对Table的特殊情况。先BS一下自己孤陋寡闻,继续努力!

由于Firefox 3.5支持HTML5.0,就写了一个简单的程序进行测试,验证了一下:

原创粉丝点击