HTML Concepts: The “Nothing” Content Model
Published on Jun 17, 2021 (updated Dec 17, 2021), filed under development, html. (Share this post, e.g., on Mastodon.)
In this little series that started with the meaning of “body-ok,” let’s move to a trivial but little-known concept: the “nothing” content model.
What is it? It literally means what it says:
When an element’s content model is nothing, the element must contain no
Textnodes (other than inter-element whitespace) and no element nodes.
If this reminds of “empty” or void elements, then because it made sense to make elements that have nothing as content, elements that require no end tag. Having a content model of “nothing” and being a void element are not identical, however, as the spec explains:
Most HTML elements whose content model is “nothing” are also, for convenience, void elements (elements that have no end tag in the HTML syntax). However, these are entirely separate concepts.
You notice “most”: Not all elements with the “nothing” content model are void elements. Best example? The template element. This is because contents of template are not children of the element itself.
Is this series interesting? Let me know in the comments (when still open) or as a response to my tweet for this post.
About Me
I’m Jens (long: Jens Oliver Meiert), and I’m an engineering lead, guerrilla philosopher, and indie publisher. I’ve worked as a technical lead and engineering manager at various companies (e.g., Google); I’m an active web and tool developer (code optimization, digital defense), a contributor to web standards (like HTML, CSS, WCAG), and a book author (O’Reilly, Frontend Dogma).
I love trying things—in web development and engineering management, but also in politics and philosophy, where I hold to one idea in particular: that we can only be well if we take good care of everyone. Here on meiert.com I talk about some of my perspectives and experiences. (Interpret charitably but be critical—and share feedback and advice that makes my work better.)
