gpt4 book ai didi

html - 为什么浏览器仍然在 HTML5 中注入(inject) ?

转载 作者:技术小花猫 更新时间:2023-10-29 11:41:35 26 4
gpt4 key购买 nike

HTML5 doctype example .

IE9 和 Chrome14 都记录 TBODY作为 tagName <table> 内的元素

The HTML5 spec on <table> 明确指出:

followed by either zero or more tbody elements or one or more tr elements

此外。 The HTML5 spec on <tr> 明确指出:

As a child of a table element, after any caption, colgroup, and thead elements, but only if there are no tbody elements that are children of the table element.

为什么浏览器会破坏我的 DOM 并注入(inject) <tbody>

  • 我没有要求
  • 没有一个也完全有效

“向后兼容性”的答案完全没有意义,因为我特别选择了 HTML5 文档类型。

最佳答案

The answer of "backwards compatiblity" makes absolutely zero sense because I specifically opted in for a HTML5 doctype.

但是,浏览器不会区分 HTML 的版本。具有 HTML5 文档类型和 HTML4 文档类型的 HTML 文档(FPI 中没有 URL 的 HTML4 过渡文档类型除外)以相同的方式解析和呈现。

我会引用 the relevant part of HTML5 parser description :

8.2.5.4.9 The "in table" insertion mode

...

A start tag whose tag name is one of: "td", "th", "tr"

Act as if a start tag token with the tag name "tbody" had been seen, then reprocess the current token.

关于html - 为什么浏览器仍然在 HTML5 中注入(inject) <tbody>?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7490364/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com