shadow DOM

A browser feature that gives a web component its own hidden DOM tree whose styles do not leak in or out.

In more detail

Ordinary CSS rules from the page cannot reach inside a shadow tree, but CSS custom properties are inherited through it. That makes custom properties the standard way to theme web components.

Example

In the browser: Page CSS does not leak in and component CSS does not leak out. Events crossing the boundary are retargeted to the host element and need composed: true to cross at all.

Related terms

Taught in

References