subtree

A node together with everything below it, which is itself a tree.

In more detail

Every node in a tree is the root of its own subtree, so operations on a whole branch can treat it as a smaller tree. In a web page, the subtree of an element is that element plus everything nested inside it.

Examples

CSS custom properties are inherited by every element in a subtree, so setting data-theme on a section themes only that section.
The inert attribute disables an element's whole subtree.
In the browser: Removing an element removes its whole subtree. A MutationObserver with subtree: true watches every descendant, not just direct children.

Related terms

Taught in

References