Get to know MDN better
このページはコミュニティーの尽力で英語から翻訳されました。MDN Web Docs コミュニティーについてもっと知り、仲間になるにはこちらから。
This feature is well established and works across many devices and browser versions. It’s been available across browsers since 2020年1月.
getRootNode() は Node インターフェイスのメソッドで、そのコンテキストのオブジェクトのルート、利用できる場合はオプションでシャドウルートを含んだものを返します。
ルートノードを取得するためのオプションを設定するオブジェクトです。利用可能なオプションは次の通りです。
Node を継承したオブジェクトです。これはどこで getRootNode() を呼び出したかによって異なる形になります。例えば、
最初に、 HTML/document ノードの参照を返す単純な例です。
この例はもっと複雑で、通常のルートを返す場合と、シャドウルートを含むルートの違いを示します。
| DOM # ref-for-dom-node-getrootnode① |
Enable JavaScript to view this browser compatibility table.
This page was last modified on 2025年6月24日 by MDN contributors.
Your blueprint for a better internet.
Visit Mozilla Corporation’s not-for-profit parent, the Mozilla Foundation.
Portions of this content are ©1998–2026 by individual mozilla.org contributors. Content available under a Creative Commons license.