ShadowRoot: host プロパティ
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since January 2020.
host
は ShadowRoot
の読み取り専用プロパティで、 ShadowRoot
が装着されている DOM 要素の参照を返します。
値
DOM の Element
です。
例
js
let customElem = document.querySelector("my-shadow-dom-element");
let shadow = customElem.shadowRoot;
// ...
// 後で、元のホスト要素を返す
let hostElem = shadow.host;
仕様書
Specification |
---|
DOM # dom-shadowroot-host |
ブラウザーの互換性
Report problems with this compatibility data on GitHubdesktop | mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
host |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
関連情報
- HTML の
part
およびexportparts
属性 - HTML の
<template>
および<slot>
要素 - CSS の
:host
,:host()
,:host-context()
擬似クラス - CSS の
::part
および::slotted
擬似クラス