问题描述
在我阅读HTML 4.0的Strict和Transitional DTD时,表格元素包含在表格元素中:
row(TR)元素: THEAD,
TFOOT和TBODY。
表格部分元素是TABLE元素的定义内容。
TR元素未被定义为立即元素。或直接或包含
元素的表格。
鉴于
i。表格部分元素的使用是可选的,但是
ii。当没有使用
HTML表格指定表格部分元素时,TBODY是隐含的,
HTML解析代理(浏览器)在构建树时所执行的操作一个
TABLE节点遇到一个TR元素而没遇到任何
表格元素?
是这样的:
1.将TR元素节点附加到TABLE节点?
或
2.检查如果存在一个表部分节点,并且未能找到一个实例化的实例,请按以下顺序执行以下步骤:
a。实例化TBODY元素节点
b。将它附加到TABLE节点
c。创建TR元素节点
d。将TR节点附加到TBODY节点
e。继续阅读HTML并根据
规范开发表格?
对我读取HTML DTD的更正非常感谢。
In my reading of the Strict and Transitional DTD for HTML 4.0, the table
row (TR) elements are contained within table section elements: THEAD,
TFOOT, and TBODY.
The table section elements are the defined contents of the TABLE element.
The TR element is not defined as an "immediate" or "direct" contained
element of TABLE.
Given that
i. the use of the table section elements is optional, but that
ii. TBODY is implicit when no table section elements are specified with an
HTML table,
what does an HTML parsing agent (browser) do when tree-building from a
TABLE node and it encounters a TR element without having encountered any
table section element?
Does it:
1. append the TR element node to the TABLE node?
OR
2. examine for the presence of a table section node, and failing to find
one instantiated, perform the following steps in this order:
a. instantiate a TBODY element node
b. append it to the TABLE node
c. create the TR element node
d. append the TR node to the TBODY node
e. continue reading the HTML and develop the table according the
specification?
Corrections to my reading of the HTML DTD are warmly appreciated.
推荐答案
我读过的消息来源说< tbody>等等是强制性的。缩进
和称为整洁的净化工具也坚持。
然而,W3C验证器并不坚持它(至少XHTML,但我认为
其他人也可以回忆起来。那么问题是你是否希望
您的页面安全验证或者仍然是一个坚持者。然后再次,
验证器进化...确保你指定一个版本号
工作。
Roy
-
Roy Schestowitz
从SGML
(HTML)角度找出应该发生的事情的最简单方法是使用SGMLNORM并让它生成
标准化标记来自您为测试设置的几个示例。
嗯,这个理论太多了;什么是www浏览器可能被编程为
会有所不同,无法准确理解
没有研究浏览器源代码。
-
Rex
The easiest way to find out what is supposed to happen from an SGML
(HTML) standpoint is to make use of SGMLNORM and let it generate
normalized markup from a few examples you set up for test.
http://valet.webthing.com/code/
Well, so much for the theory; what a www browser might be programmed to
do will be something different and can not be precisely understood
without a study of the browsers source code.
--
Rex
嗯,是的,这将是一个(有点复杂)的不同变体/>
我写的描述,假设追加意味着创造一些东西
对应于子元素关系。
这是处理可忽略标签的特殊情况。考虑
以下相当简单的HTML 4.01文档:
<!DOCTYPE HTML PUBLIC" - // W3C // DTD HTML 4.01 Transitional // EN" ;
" http://www.w3.org/TR/html4/loose.dtd">
< title> demo< / title>
< p> Hello world。< / p>
再见世界。
HTML解析器需要推断出很多开始和结束标签或 - 以另一种方式将
放入其中 - 即使有些开始和结束也要识别元素
标签已被省略。例如,在看到标记< p>时,解析器
需要得出结论已经启动的HEAD元素(尽管它的
开始标记必须被推断)必须被视为已关闭(在某种意义上,
< / head>首先暗示)并且BODY元素已经启动(在
意义上,< ;身体>暗示下一步)。逻辑文档树包含
HTML元素作为根元素,HEAD和BODY元素作为其
子元素(即使所有这三个元素都有它们的开头和
结束标签省略),P元素是BODY的子元素。
这意味着,例如,如果有样式表规则,对BODY元素应用
,它会影响文本Bye world。,它直接在BODY元素内部进行
,并且可能通过继承间接影响,P元素中的
文本。有些浏览器过去常常出错 - 例如,
他们在开始标记< body>时没有应用这样的规则。被省略 - 所以
可能他们在正确构建文档树方面并不擅长。
***
你毫无意义地转向_three_ groups。对于这个问题,JavaScript组是
_certainly_错误。我限制了
小组的后续行动,该小组最专门针对您的问题
所属的主题。
- -
Yucca,
关于网页制作的网页:
Well, yes, that would be a (somewhat complicated) different variant of the
description I wrote, assuming that "appending" means creation of something
that corresponds to subelement relationship.
It''s really a special case of handling omissible tags. Consider the
following fairly minimal HTML 4.01 document:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<title>demo</title>
<p>Hello world.</p>
Bye world.
An HTML parser needs to infer quite a many start and end tags or - to put
it in another way - to recognize elements even though some start and end
tags have been omitted. For example, upon seeing the tag <p>, the parser
needs to conclude that the HEAD element that had been started (though its
start tag had to be inferred) must be considered as closed (in a sense,
</head> is implied first) and that the BODY element has been started (in a
sense, <body> is implied next). The logical document tree does contains the
HTML element as the root element and the HEAD and BODY element as its
subelements (even though all of these three elements have their start and
end tags omitted), and the P element is a subelement of BODY.
This means, for example, that if there is a style sheet rule that applies
to the BODY element, it affects the text "Bye world.", which is directly
inside the BODY element, and it may affect indirectly, via inheritance, the
text inside the P element. Some browsers used to get this wrong - e.g.,
they did not apply such a rule when the start tag <body> was omitted - so
probably they were not that good at building document trees correctly.
***
You pointlessly crossposted to _three_ groups. The JavaScript group was
_certainly_ wrong for this question. I have restricted followups to the
group that is most specifically devoted to the topic that your question
belongs to.
--
Yucca, http://www.cs.tut.fi/~jkorpela/
Pages about Web authoring: http://www.cs.tut.fi/~jkorpela/www.html
这篇关于TR元素可以是TABLE元素的直接子节点吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!