html/manual/
categories.rs

1//! HTML content categories
2//!
3//! Each element in HTML falls into zero or more categories that group elements
4//! with similar characteristics together.
5//!
6//! # References
7//!
8//! - [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/HTML/Content_categories)
9//! - [HTML Specification](https://html.spec.whatwg.org/multipage/dom.html#kinds-of-content)
10
11/// The Metadata content category
12///
13/// Metadata content is content that sets up the presentation or behavior of the
14/// rest of the content, or that sets up the relationship of the document with
15/// other documents, or that conveys other "out of band" information.
16///
17/// # References
18///
19/// - [HTML Specification](https://html.spec.whatwg.org/multipage/dom.html#metadata-content)
20pub trait MetadataContent {}
21
22/// The Flow content category
23///
24/// Most elements that are used in the body of documents and applications are
25/// categorized as flow content.
26///
27/// # References
28///
29/// - [HTML Specification](https://html.spec.whatwg.org/multipage/dom.html#flow-content)
30pub trait FlowContent {}
31
32/// The Sectioning content category
33///
34/// Sectioning content is content that defines the scope of header and footer
35/// elements.
36///
37/// # References
38///
39/// - [HTML Specification](https://html.spec.whatwg.org/multipage/dom.html#sectioning-content)
40pub trait SectioningContent: FlowContent {}
41
42/// The Heading content category
43///
44/// Heading content defines the heading of a section (whether explicitly marked
45/// up using sectioning content elements, or implied by the heading content
46/// itself).
47///
48/// # References
49///
50/// - [HTML Specification](https://html.spec.whatwg.org/multipage/dom.html#heading-content)
51pub trait HeadingContent: FlowContent {}
52
53/// The Phrasing content category
54///
55/// Phrasing content is the text of the document, as well as elements that mark
56/// up that text at the intra-paragraph level. Runs of phrasing content form
57/// paragraphs.
58///
59/// # References
60///
61/// - [HTML Specification](https://html.spec.whatwg.org/multipage/dom.html#phrasing-content)
62pub trait PhrasingContent: FlowContent {}
63
64/// The Embedded content category
65///
66/// Embedded content is content that imports another resource into the document,
67/// or content from another vocabulary that is inserted into the document.
68///
69/// # References
70///
71/// - [HTML Specification](https://html.spec.whatwg.org/multipage/dom.html#embedded-content)
72pub trait EmbeddedContent: PhrasingContent {}
73
74/// The Interactive content category
75///
76/// Interactive content is content that is specifically intended for user
77/// interaction.
78///
79/// # References
80///
81/// - [HTML Specification](https://html.spec.whatwg.org/multipage/dom.html#interactive-content)
82pub trait InteractiveContent: FlowContent {}
83
84/// The Palpable content category
85///
86/// As a general rule, elements whose content model allows any flow content or
87/// phrasing content should have at least one node in its contents that is
88/// palpable content and that does not have the hidden attribute specified.
89///
90/// This requirement is not a hard requirement, however, as there are many cases
91/// where an element can be empty legitimately, for example when it is used as a
92/// placeholder which will later be filled in by a script, or when the element
93/// is part of a template and would on most pages be filled in but on some pages
94/// is not relevant.
95///
96/// # References
97///
98/// - [HTML Specification](https://html.spec.whatwg.org/multipage/dom.html#palpable-content)
99pub trait PalpableContent {}
100
101/// The Script-supporting elements content category
102///
103/// Script-supporting elements are those that do not represent anything
104/// themselves (i.e. they are not rendered), but are used to support scripts,
105/// e.g. to provide functionality for the user.
106///
107/// # References
108///
109/// - [HTML Specification](https://html.spec.whatwg.org/multipage/dom.html#script-supporting-elements)
110pub trait ScriptSupportingContent {}
111
112/// The Transparent content category
113///
114/// Some elements are described as transparent; they have "transparent" in the
115/// description of their content model. The content model of a transparent
116/// element is derived from the content model of its parent element: the
117/// elements required in the part of the content model that is "transparent" are
118/// the same elements as required in the part of the content model of the parent
119/// of the transparent element in which the transparent element finds itself.
120///
121/// # References
122///
123/// - [HTML Specification](https://html.spec.whatwg.org/multipage/dom.html#transparent-content-models)
124pub trait TransparentContent {}