From 5fbfeee5908241590dacb0f0aac3859f61360947 Mon Sep 17 00:00:00 2001 From: Masahiro FUJIMOTO Date: Sun, 27 Feb 2022 13:04:02 +0900 Subject: Node インターフェイスのメソッドの記事を移行 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/node/comparedocumentposition/index.html | 118 --------------------- 1 file changed, 118 deletions(-) delete mode 100644 files/ja/web/api/node/comparedocumentposition/index.html (limited to 'files/ja/web/api/node/comparedocumentposition/index.html') diff --git a/files/ja/web/api/node/comparedocumentposition/index.html b/files/ja/web/api/node/comparedocumentposition/index.html deleted file mode 100644 index 5865081c84..0000000000 --- a/files/ja/web/api/node/comparedocumentposition/index.html +++ /dev/null @@ -1,118 +0,0 @@ ---- -title: Node.compareDocumentPosition -slug: Web/API/Node/compareDocumentPosition -tags: - - DOM - - DOM Element Methods - - Gecko - - Gecko DOM Reference -translation_of: Web/API/Node/compareDocumentPosition ---- -
{{ApiRef}}
- -

概要

- -

そのノードと別のノードの位置を比較し、結果となるビットマスクを返します。

- -

構文

- -
node.compareDocumentPosition( otherNode )
-
- -

パラメーター

- -
-
node
-
比較元ノード
-
otherNode
-
node と比較する別ノード
-
- -

返り値

- -

呼び出し元の node と {{domxref("Document")}} 内の otherNode の関係を表すビットの整数値。複数の条件に適応する場合、1つ以上のビットがセットされることがあります。compareDocumentPosition() を呼び出した node と比較して、otherNode が 文書のより前にあり、かつ node を含んでいるならば、DOCUMENT_POSITION_CONTAINS と DOCUMENT_POSITION_PRECEDING のビットがセットされ、結果は0x0Aもしくは10進数の10になります。

- -

注記

- -

戻り値は以下の値を持つビットマスクの何れかとなります。

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
名称
DOCUMENT_POSITION_DISCONNECTED1
DOCUMENT_POSITION_PRECEDING2
DOCUMENT_POSITION_FOLLOWING4
DOCUMENT_POSITION_CONTAINS8
DOCUMENT_POSITION_CONTAINED_BY16
DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC32
- -

- -
var head = document.getElementsByTagName('head').item(0);
-
-if ( head.compareDocumentPosition(document.body) & Node.DOCUMENT_POSITION_FOLLOWING ) {
-  console.log("head 要素は body 要素より前に記述されています。");
-} else {
-  console.log("head 要素は body 要素の前に配置しなくてはなりません。");
-}
-
- -
-

注記: compareDocumentPosition の戻り値はビットマスクです。よって、有意な結果を得るには ビット演算子の "&" を用いなくてはならない点に注意して下さい。

-
- -

仕様

- - - - - - - - - - - - - - - - - - - - - -
仕様書策定状況コメント
DOM Level 3Recommendation
DOM StandardLiving standard
- -

関連情報

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