ShadowRoot.host

The host read-only property of the ShadowRoot returns a reference to the DOM element the ShadowRoot is attached to.

Syntax

const someElement = shadowRoot.host

Value

A  DOM Element.

Examples

let customElem = document.querySelector('my-shadow-dom-element');
let shadow = customElem.shadowRoot;

  ...

// return the original host element some time later
let hostElem = shadow.host;

Specifications

Specification Status Comment
DOM
The definition of 'ShadowRoot.host' in that specification.
Living Standard

Browser compatibility

BCD tables only load in the browser