shadow DOM slots
Shadow DOM supports <slot> elements, that are filled by the content from light DOM.
Last updated
Was this helpful?
Shadow DOM supports <slot> elements, that are filled by the content from light DOM.
Last updated
Was this helpful?
⟩ ⟩ ⟩ ⟩ slots
if those descendants include a <slot>
element, then the of the element are displayed as if they were children of that <slot>
(they do not actually become part of the shadow DOM), replacing any shadow DOM content in the slot.
if shadow DOM does not include a <slot>
, then any light DOM content of the is never displayed.
if shadow DOM has a <slot>
, but the has no light DOM children, then the shadow DOM content of the slot is displayed as a default.
the flattened DOM exists only for rendering and event-handling purposes. It’s kind of “virtual”. That’s how things are shown. But the nodes in the document are actually not moved around! 👉 See "flattened DOM" tab above.
The process of rendering inside their slots is called “composition”.