Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Web/API/ShadowRoot/host を更新 #23847

Merged
merged 1 commit into from
Oct 3, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 15 additions & 11 deletions files/ja/web/api/shadowroot/host/index.md
Original file line number Diff line number Diff line change
@@ -1,29 +1,26 @@
---
title: ShadowRoot.host
title: "ShadowRoot: host プロパティ"
short-title: host
slug: Web/API/ShadowRoot/host
l10n:
sourceCommit: 584e1d86cc4d770f43b32ec62613a4840d2821db
---

{{APIRef("Shadow DOM")}}

**`host`** は {{domxref("ShadowRoot")}} の読み取り専用プロパティで、 `ShadowRoot` が取り付けられている DOM 要素の参照を返します。
**`host`** は {{domxref("ShadowRoot")}} の読み取り専用プロパティで、 `ShadowRoot` が装着されている DOM 要素の参照を返します。

## 構文

```js
const someElement = shadowRoot.host;
```

### 値
## 値

DOM の {{domxref('Element')}} です。

## 例

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

...
// ...

// 後で、元のホスト要素を返す
let hostElem = shadow.host;
Expand All @@ -36,3 +33,10 @@ let hostElem = shadow.host;
## ブラウザーの互換性

{{Compat}}

## 関連情報

- HTML の [`part`](/ja/docs/Web/HTML/Global_attributes#part) および [`exportparts`](/ja/docs/Web/HTML/Global_attributes#exportparts) 属性
- HTML の {{HTMLelement("template")}} および {{HTMLElement("slot")}} 要素
- CSS の {{CSSXref(":host")}}, {{CSSXref(":host_function", ":host()")}}, {{CSSXref(":host-context", ":host-context()")}} 擬似クラス
- CSS の {{CSSXref("::part")}} および {{CSSXref("::slotted")}} 擬似クラス