69
This is then followed by a description of what the elementrepresentsp112
, along with any additional normative conformance criteria that may apply to
authors and implementations. Examples are sometimes also included.
3.2.3.1 Attributes
An attribute value is a string. Except where otherwise specified, attribute values onHTML elementsp43
may be any string value, including the empty
string, and there is no restriction on what text can be specified in such attribute values.
Each element defined in this specification has a content model: a description of the element's expectedcontentsp115
. AnHTML elementp43
must
have contents that match the requirements described in the element's content model. Thecontentsof an element are its children in the DOM,
except fortemplatep579
elements, where the children are those in thetemplate contentsp580
(a separateDocumentFragment
assigned to the
element when the element is created).
Thespace charactersp64
are always allowed between elements. User agents represent these characters between elements in the source markup as
Text
nodes in the DOM. EmptyText
nodes andText
nodes consisting of just sequences of those characters are consideredinter-element
whitespace.
Inter-element whitespacep115
, comment nodes, and processing instruction nodes must be ignored when establishing whether an element's contents
match the element's content model or not, and must be ignored when following algorithms that define document and element semantics.
Authors must not useHTML elementsp43
anywhere except where they are explicitly allowed, as defined for each element, or as explicitly required
by other specifications. For XML compound documents, these contexts could be inside elements from other namespaces, if those elements are
defined as providing the relevant contexts.
In addition,HTML elementsp43
may be orphan nodes (i.e. without a parent node).
3.2.4.1 The "nothing" content model
When an element's content model isnothing, the element must contain noText
nodes (other thaninter-element whitespacep115
) and no element
nodes.
Thus, an elementAis said to bepreceded or followedby a second elementBifAandBhave the same parent node and there are no
other element nodes orText
nodes (other thaninter-element whitespacep115
) between them. Similarly, a node is theonly childof an
element if that element contains no other nodes other thaninter-element whitespacep115
, comment nodes, and processing instruction
nodes.
Note
For example, the Atom specification defines acontentelement. When itstypeattribute has the valuexhtml, the Atom specification
requires that it contain a single HTMLdivp206
element. Thus, adivp206
element is allowed in that context, even though this is not
explicitly normatively stated by this specification.[ATOM]p1158
Example
For example, creating atdp409
element and storing it in a global variable in a script is conforming, even thoughtdp409
elements are
otherwise only supposed to be used insidetrp407
elements.
var data = {
name: "Banana",
cell: document.createElement('td'),
};
Example
Most HTML elements whose content model is "nothing" are also, for convenience,void elementsp952
(elements that have noend tagp954
in
theHTML syntaxp951
). However, these are entirely separate concepts.
Note
3.2.4Content models
115