MDN wants to learn about developers like you: https://qsurvey.mozilla.com/s3/MDN-survey

ShadowRoot.host

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

Syntax

var element = shadowRoot.host

Value

A  DOM Element.

Examples

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

  ...

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

Specifications

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

Browser compatibility

We're converting our compatibility data into a machine-readable JSON format. This compatibility table still uses the old format, because we haven't yet converted the data it contains. Find out how you can help!

Feature Chrome Edge Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Basic support 53 ? ? ? 40 10
Feature Android Edge Firefox Mobile (Gecko) IE Phone Opera Mobile Safari Mobile
Basic support 53 ? ? ? 40 10.1

Document Tags and Contributors

 Contributors to this page: chrisdavidmills, fscholz, sideshowbarker, arthurevans, jpmedley
 Last updated by: chrisdavidmills,