HTMLSlotElement: assignedElements() method - Web APIs | MDN

Syntax

js

assignedElements()
assignedElements(options)

Parameters

options Optional

An object that sets options for the nodes to be returned. The available options are:

flatten

A boolean value indicating whether to return the assigned elements of any available child <slot> elements (true) or not (false). Defaults to false.

Return value

An array of elements.

Examples

js

let slots = this.shadowRoot.querySelector("slot");
let elements = slots.assignedElements({ flatten: true });

Specifications

Specification
HTML
# dom-slot-assignedelements-dev

Browser compatibility

Help improve MDN

Learn how to contribute

This page was last modified on by MDN contributors.