The host
read-only property of the ShadowRoot
returns a reference to the DOM element the ShadowRoot
is attached to.
The host
read-only property of the ShadowRoot
returns a reference to the DOM element the ShadowRoot
is attached to.
A DOM Element
.
js
let customElem = document.querySelector("my-shadow-dom-element"); let shadow = customElem.shadowRoot; // ... // return the original host element some time later let hostElem = shadow.host;
Specification |
---|
DOM Standard # dom-shadowroot-host |
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | |
host |
53 | 79 | 63 | No | 40 | 10 | 53 | 53 | 63 | 41 | 10 | 6.0 |
© 2005–2023 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/ShadowRoot/host