From 33058f2b292b3a581333bdfb21b8f671898c5060 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:40:17 -0500 Subject: initial commit --- files/ja/web/api/node/contains/index.html | 110 ++++++++++++++++++++++++++++++ 1 file changed, 110 insertions(+) create mode 100644 files/ja/web/api/node/contains/index.html (limited to 'files/ja/web/api/node/contains') diff --git a/files/ja/web/api/node/contains/index.html b/files/ja/web/api/node/contains/index.html new file mode 100644 index 0000000000..194cdbb2eb --- /dev/null +++ b/files/ja/web/api/node/contains/index.html @@ -0,0 +1,110 @@ +--- +title: Node.contains +slug: Web/API/Node/contains +tags: + - API + - DOM + - Method + - Node +translation_of: Web/API/Node/contains +--- +
{{APIRef("DOM")}}
+ +

Node.contains メソッドは指定ノードの子孫ノードに特定の子ノード(※自身も含む)が含まれるかどうかを示す真偽値を返します。

+ +

構文

+ +
node.contains( otherNode )
+
+ +

+ +

この関数は、ある要素がそのページの body 要素に含まれるかどうかをチェックするものです。contains は包括的かつ決定的であるため、body がそれ自身を含むかどうかは isInPage の意図ではないため明示的に false を返します。

+ +
function isInPage(node) {
+  return (node === document.body) ? false : document.body.contains(node);
+}
+ +

仕様

+ + + + + + + + + + + + + + + + +
仕様ステータスコメント
{{SpecName("DOM WHATWG", "#dom-node-contains", "Node.contains()")}}{{Spec2("DOM WHATWG")}}Initial definition
+ +

ブラウザ実装状況

+ +

{{CompatibilityTable}}

+ +
+ + + + + + + + + + + + + + + + + + + + + +
機能ChromeEdgeFirefox (Gecko)Internet ExplorerOperaSafari
基本サポート{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatGeckoDesktop("9.0")}}5.0[1]{{CompatVersionUnknown}}3.0[2]
+
+ +
+ + + + + + + + + + + + + + + + + + + + + +
機能AndroidEdgeFirefox Mobile (Gecko)IE MobileOpera MobileSafari Mobile
基本サポート{{CompatUnknown}}{{CompatVersionUnknown}}{{CompatGeckoMobile("9.0")}}{{CompatUnknown}}{{CompatUnknown}}{{CompatUnknown}}
+
+ +

[1] Internet Explorer は elements の contains() のみサポートしています。

+ +

[2] Safari 2.x には正しく contains() が実装されていません。

+ +

関連情報

+ + -- cgit v1.2.3-54-g00ecf