TR元素可以是TABLE元素的直接子节点吗? [英] Can TR element be direct child node of TABLE element?

查看:108
本文介绍了TR元素可以是TABLE元素的直接子节点吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




在我阅读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.

推荐答案

Patient Guy写道:
Patient Guy wrote:


在阅读HTML 4.0的Strict和Transitional DTD时,表格
行(TR)元素包含在表部分元素中:THEAD,
TFOOT和TBODY。

表部分元素是TABLE元素的已定义内容。 TR元素未定义为立即元素。或直接或包含
TABLE的元素。

鉴于此

我。表格部分元素的使用是可选的,但是那个
ii。当没有使用HTML表格指定表格节元素时,TBODY是隐含的,



TABLE节点构建树时HTML解析代理(浏览器)执行的操作是什么它遇到了一个没有遇到任何
表格元素的TR元素吗?

它是否:

1.将TR元素节点附加到TABLE节点?



2.检查是否存在表节节点,并且未能找到一个实例化的节点,按此顺序执行以下步骤:
一个。实例化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
http:// schestowitz.com


On Sun,2005年2月13日11:17:00格林尼治标准时间,患者盖伊

< Pa ** *******@nowhere.to.be.found.com>写道:


[..fup'减少,因为这不是关于脚本..]
On Sun, 13 Feb 2005 11:17:00 GMT, Patient Guy
<Pa*********@nowhere.to.be.found.com> wrote:

[..fup''s reduced since this is not about scripting..]
在我阅读Strict和用于HTML 4.0的Transitional DTD,表格
row(TR)元素包含在表格部分元素中:THEAD,
TFOOT和TBODY。

表格部分元素是定义的TABLE元素的内容.TR元素未被定义为立即元素。或直接或包含了TABLE的元素。


[...]

HTML解析代理(浏览器)在构建树时所做的事情。
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.
[...]
what does an HTML parsing agent (browser) do when tree-building from..




从SGML

(HTML)角度找出应该发生的事情的最简单方法是使用SGMLNORM并让它生成

标准化标记来自您为测试设置的几个示例。

http://valet.webthing.com/code/


嗯,这个理论太多了;什么是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


患者家伙< Pa ********* @ nowhere.to .be.found.com>写道:
Patient Guy <Pa*********@nowhere.to.be.found.com> wrote:
在我阅读HTML 4.0的Strict和Transitional DTD时,
表行(TR)元素包含在表格部分元素中:
THEAD ,TFOOT和TBODY。


这是正确的。对于HTML 4.01也是如此,这些日子比HTML 4.0更好的阅读(尽管差异很小而且不重要。

)。 />
表格部分元素是TABLE
元素的已定义内容。 TR元素未被定义为立即的元素。或者直接包含TABLE的元素。


正确。当您查看

有效HTML 4.01文档的源代码时,事情可能会有所不同,但那是因为您没有看到可省略的

启动和结束标记,如果它们被省略。


在XHTML中,事情会发生变化,因为它不允许任何开始或结束标记

省略。 XHTML 1.0的作者不希望禁止在TABLE元素内部写入TR元素而不干预标记的旧实践,因此

他们构成了一个临时规则,允许TR作为TABLE的直接后代

(好吧,tr作为表的直接后代,说XML):

<!ELEMENT table

(标题?,(col * | colgroup *),thead?,tfoot?,(tbody + | tr +))>

鉴于

i。表格部分元素的使用是可选的,


不是真的。元素THEAD和TFOOT是可选的,但是TBODY元素

是TABLE元素内容的必需部分。 _tags_< tbody>和

< / tbody>但是是可选的。

但是那个
ii。当没有使用
HTML表格指定表格部分元素时,TBODY是隐含的,


不是真的。元素的开始和结束标记是隐含的。

当从TABLE节点构建树时,HTML解析代理(浏览器)做什么,它遇到TR元素而没有遇到任何表格部分元素?


从技术上讲,HTML解析代理不需要构建任何树,通过

HTML规范。出于实际原因,需要一些树形结构。

处理< tr>的适当方法。在TABLE元素中遇到的标记

但没有看到任何< thead>,< tfoot>或< tbody>标签是暗示一个

< tbody>标签。因此,树应该具有TBODY元素作为TABLE的子元素,并且TR元素作为其子元素。是否

浏览器实际上这可能不会直接显示。

是否:

1.将TR元素节点附加到TABLE节点?


这对HTML 4.0或HTML 4.01不合适(虽然对于

XHTML 1.0来说是正确的)。

OR

2.检查是否存在表节节点,并且未能找到一个实例化的节点,按此顺序执行以下步骤:
a。实例化TBODY元素节点
b。将它附加到TABLE节点
c。创建TR元素节点
d。将TR节点附加到TBODY节点
e。继续阅读HTML并根据
规范开发表格?
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.
That is correct. The same is true for HTML 4.01, which is better reading
these days than HTML 4.0 (though the differences are small and don''t matter
here).
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.
Correct. Things may _look_ different when you look at the source code of a
valid HTML 4.01 document, but that''s because you don''t see the omissable
start and end tags if they have been omitted.

In XHTML things change, since it does not allow any start or end tag
omission. Authors of XHTML 1.0 did not want to disallow the old practice of
writing TR elements inside a TABLE element without intervening markup, so
they made up an ad hoc rule, allowing TR as direct descendant of TABLE
(well, tr as direct descendant of table, to speak XML):
<!ELEMENT table
(caption?, (col*|colgroup*), thead?, tfoot?, (tbody+|tr+))>
Given that

i. the use of the table section elements is optional,
Not really. The elements THEAD and TFOOT are optional, but a TBODY element
is a required part of a TABLE element''s content. The _tags_ <tbody> and
</tbody> are optional, though.
but that
ii. TBODY is implicit when no table section elements are specified with
an HTML table,
Not really. The element''s start and end tags are implicit.
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?
Technically, an HTML parsing agent is not required to build any tree, by
HTML specifications. For practical reasons, some tree structure is needed.
The appropriate way to handle a <tr> tag encountered inside a TABLE element
but without having seen any <thead>, <tfoot>, or <tbody> tag is to imply a
<tbody> tag. Consequently, the tree should have a TBODY element as a
subelement of TABLE and with the TR element(s) as its subelements. Whether
browsers actually do this might not be directly visible.
Does it:

1. append the TR element node to the TABLE node?
That would be inappropriate for HTML 4.0 or HTML 4.01 (though correct for
XHTML 1.0).
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?




嗯,是的,这将是一个(有点复杂)的不同变体/>
我写的描述,假设追加意味着创造一些东西

对应于子元素关系。


这是处理可忽略标签的特殊情况。考虑

以下相当简单的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, http://www.cs .tut.fi / ~jkorpela /

关于网页制作的网页: http://www.cs.tut.fi/~jkorpela/www.html



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元素的直接子节点吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆