标题标签有内容吗?
Does the title tag have content?
在我看来,内容在 HTML 中被定义为两个独立的事物:
1) All of the information between the open and closed body tags that is visible on a webpage.
2) That which is visible on a webpage that is placed between any open and closed tags.
这看起来 knit-picky,但在教授 HTML 内容的概念时很重要 -- 我相信在教授计算机编程术语时建立并保持一致的定义。
第一个正确吗? -- 在这种情况下 <title>
将没有内容。或者第二个是正确的? -- 在这种情况下 <title>
会有内容。
"Content" 在 HTML 的上下文中不是主观的。我们有幸拥有a spec which defines everything, so there's no "point of view" to be had. The spec clearly defines every element's content model, which is defined as "A normative description of what content must be included as children and descendants of the element."
3.2.4 Content models
Each element defined in this specification has a content model: a description of the element's expected contents. An HTML element must have contents that match the requirements described in the element's content model. The contents of an element are its children in the DOM, except for template
elements, where the children are those in the template contents (a separate DocumentFragment
assigned to the element when the element is created).
The spec dictates that the <title>
element's content model is
Content model:
Text that is not inter-element whitespace.
仅此而已。
在我看来,内容在 HTML 中被定义为两个独立的事物:
1) All of the information between the open and closed body tags that is visible on a webpage.
2) That which is visible on a webpage that is placed between any open and closed tags.
这看起来 knit-picky,但在教授 HTML 内容的概念时很重要 -- 我相信在教授计算机编程术语时建立并保持一致的定义。
第一个正确吗? -- 在这种情况下 <title>
将没有内容。或者第二个是正确的? -- 在这种情况下 <title>
会有内容。
"Content" 在 HTML 的上下文中不是主观的。我们有幸拥有a spec which defines everything, so there's no "point of view" to be had. The spec clearly defines every element's content model, which is defined as "A normative description of what content must be included as children and descendants of the element."
3.2.4 Content models
Each element defined in this specification has a content model: a description of the element's expected contents. An HTML element must have contents that match the requirements described in the element's content model. The contents of an element are its children in the DOM, except for
template
elements, where the children are those in the template contents (a separateDocumentFragment
assigned to the element when the element is created).
The spec dictates that the <title>
element's content model is
Content model:
Text that is not inter-element whitespace.
仅此而已。