HTML Concepts: The “Nothing” Content Model

Published on June 17, 2021 (↻ December 17, 2021), filed under (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.

Was this useful or interesting? Share (toot) this post, or maybe treat me to a coffee. Thanks!

About Me

Jens Oliver Meiert, on September 30, 2021.

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 close to W3C and WHATWG, 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 views and experiences.

If you want to do me a favor, interpret charitably (I speak three languages, and they can collide), yet be critical and give feedback for me to learn and improve. Thank you!