Web/API/HTMLSlotElement/assignedElements

From Get docs


The assignedElements() property of the HTMLSlotElement interface returns a sequence of the elements assigned to this slot (and no other nodes). If the flatten option is set to true, it also returns the assigned elements of any other slots that are descendants of this slot. If no assigned nodes are found, it returns the slot's fallback content.

Syntax

var assignedElements = HTMLSlotElement.assignedElements(options)

Parameters

options Optional
An object that sets options for the nodes to be returned. The available options are:
flatten
  • A Boolean 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

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

Specifications

Specification Status Comment
HTML Living StandardThe definition of 'assignedElements()' in that specification. Living Standard  

Browser Compatibility

Update compatibility data on GitHub

Desktop Mobile
Chrome Edge Firefox Internet Explorer Opera Safari Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet

assignedElements

Experimental'

Chrome

Full support 65

Edge

Full support 79

Firefox

Full support 66

IE

No support No

Opera

Full support Yes

Safari

?

WebView Android

Full support 65

Chrome Android

Full support 65

Firefox Android

Full support 66

Opera Android

Full support Yes

Safari iOS

?

Samsung Internet Android

Full support 9.0

Legend

Full support  
Full support
No support  
No support
Compatibility unknown  
Compatibility unknown
Experimental. Expect behavior to change in the future.'
Experimental. Expect behavior to change in the future.