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, and I’m an engineering lead and author. 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.

With my current move to Spain, I’m open to a new remote frontend leadership position. Feel free to review and refer my CV or LinkedIn profile.

I love trying things, not only in web development, but also in other areas like philosophy. Here on meiert.com I share some of my views and experiences.