HTML Concepts: The “Nothing” Content Model

Published on June 17, 2021 (↻ December 17, 2021), filed under (RSS feed).

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.

Toot about this?

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, 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, but also in other areas like philosophy. Here on meiert.com I share some of my views and experiences.

If you have a question or suggestion about what I write, please leave a comment (if available) or a message. Thank you!