HTML Concepts: The “Nothing” Content Model
Published on June 17, 2021 (↻ December 17, 2021), filed under Development (RSS feed for all categories).
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
Text
nodes (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 a frontend engineering leader and tech author/publisher. I’ve worked as a technical lead for companies like Google and as an engineering manager for companies like Miro, I’m a contributor to several web standards, and I write and review books for O’Reilly and Frontend Dogma.
I love trying things, not only in web development (and engineering management), but also in other areas like philosophy. Here on meiert.com I share some of my experiences and views. (Be critical, interpret charitably, and give feedback.)
Read More
Maybe of interest to you, too:
- Next: Website Optimization Measures, Part XII
- Previous: Reasons to Listen to Whom You Don’t Agree With
- More under Development
- More from 2021
- Most popular posts
Looking for a way to comment? Comments have been disabled, unfortunately.
Get a good look at web development? Try WebGlossary.info—and The Web Development Glossary 3K. With explanations and definitions for thousands of terms of web development, web design, and related fields, building on Wikipedia as well as MDN Web Docs. Available at Apple Books, Kobo, Google Play Books, and Leanpub.