Day 36 of 100DaysOfSpec, 3.2.4 Content Models
I am reading and taking notes on the HTML specifications for 100 days as part of #The100DayProject. Read the initial intent/backstory. I am a Microsoft employee but all opinions, comments, etc on this site are my own. I do not speak on behalf of my employer, and thus no comments should be taken as representative of Microsoft’s official opinion of the spec. Subsections not listed below were read without comment.
Currently reading in 3.2.4 Content models.
Just gonna leave this here: “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).”
Space characters are always allowed between elements. This is something that sort of happens naturally when authoring documents, but I feel like I’ve heard similar questions (“can I/should I put spaces here?”) from beginners. This space is called inter-element whitespace.
Inter-element whitespace is ignored when processing the document’s semantics and whether or not the contents
HTML elements can be “orphan” nodes. Interestingly: “creating a td element and storing it in a global variable in a script is conforming, even though td elements are otherwise only supposed to be used inside tr elements”.
126.96.36.199 Kinds of content
Elements can (and nearly always do) belong to more than one category:
- Flow (encompasses almost all other categories, except for some of “metadata”)
There’s a nice little chart, too.
188.8.131.52.1 Metadata content
- Defines presentation/behavior of the rest of the content (like CSS styling) or
- Sets relationship of doc to other documents (like next and previous links) or
- “Conveys other ‘out of band’ information.”
Not sure what files under that last misc item, feel like “title” might be a good example unless that falls under the category for whatever reason.
Short list of example elements: base, link, meta, noscript, script, style, template, title
184.108.40.206.2 Flow content
Most elements in the
<body>, see spec for full list.