diff options
author | MDN <actions@users.noreply.github.com> | 2021-03-16 00:26:29 +0000 |
---|---|---|
committer | MDN <actions@users.noreply.github.com> | 2021-03-16 00:26:29 +0000 |
commit | d49032372e1ad262a313dc974d8de6bb6efbf784 (patch) | |
tree | 3d0d5ba8caa558ed95ab3223e461ba60908de3d8 /files/ja/web/api/document/elementsfrompoint | |
parent | 6cc1c55b8391c160f9df683eebd3c35196dfd46c (diff) | |
download | translated-content-d49032372e1ad262a313dc974d8de6bb6efbf784.tar.gz translated-content-d49032372e1ad262a313dc974d8de6bb6efbf784.tar.bz2 translated-content-d49032372e1ad262a313dc974d8de6bb6efbf784.zip |
[CRON] sync translated content
Diffstat (limited to 'files/ja/web/api/document/elementsfrompoint')
-rw-r--r-- | files/ja/web/api/document/elementsfrompoint/index.html | 103 |
1 files changed, 103 insertions, 0 deletions
diff --git a/files/ja/web/api/document/elementsfrompoint/index.html b/files/ja/web/api/document/elementsfrompoint/index.html new file mode 100644 index 0000000000..a885ce197f --- /dev/null +++ b/files/ja/web/api/document/elementsfrompoint/index.html @@ -0,0 +1,103 @@ +--- +title: DocumentOrShadowRoot.elementsFromPoint() +slug: Web/API/Document/elementsFromPoint +tags: + - API + - Document + - DocumentOrShadowRoot + - Method + - Reference + - ShadowRoot + - elementsFromPoint + - elementsFromPoint() + - shadow dom + - メソッド +translation_of: Web/API/DocumentOrShadowRoot/elementsFromPoint +original_slug: Web/API/DocumentOrShadowRoot/elementsFromPoint +--- +<div>{{APIRef("DOM")}}{{SeeCompatTable}}</div> + +<p><span class="seoSummary"><strong><code>elementsFromPoint()</code></strong> は {{domxref("DocumentOrShadowRoot")}} インターフェイスのメソッドで、指定された座標 (ビューポートからの相対) にあるすべての要素の配列を返します。</span></p> + +<p>これは {{domxref("DocumentOrShadowRoot.elementFromPoint", "elementFromPoint()")}} メソッドと同じような方法で動作します。</p> + +<h2 id="Syntax" name="Syntax">構文</h2> + +<pre class="syntaxbox">const elements = document.elementsFromPoint(<var>x</var>, <var>y</var>);</pre> + +<h3 id="Parameters" name="Parameters">引数</h3> + +<dl> + <dt><code><var>x</var></code></dt> + <dd>点の水平座標です。</dd> + <dt><code><var>y</var></code></dt> + <dd>点の垂直座標です。</dd> +</dl> + +<h3 id="Return_value" name="Return_value">返値</h3> + +<p>{{domxref("Element")}} オブジェクトの配列です。</p> + +<h2 id="Example" name="Example">例</h2> + +<h3 id="HTML">HTML</h3> + +<pre class="brush: html"><div> + <p>Some text</p> +</div> +<p>Elements at point 30, 20:</p> +<div id="output"></div> +</pre> + +<h3 id="JavaScript">JavaScript</h3> + +<pre class="brush: js;highlight[1]">let output = document.getElementById("output"); +if (document.elementsFromPoint) { + let elements = document.elementsFromPoint(30, 20); + for (var i = 0; i < elements.length; i++) { + output.textContent += elements[i].localName; + if (i < elements.length - 1) { + output.textContent += " < "; + } + } +} else { + output.innerHTML = "<span style=\"color: red;\">" + + "Browser does not support <code>document.elementsFromPoint()</code>" + + "</span>"; +}</pre> + +<p>{{EmbedLiveSample('Example', '420', '120')}}</p> + +<h2 id="Specifications" name="Specifications">仕様書</h2> + +<table class="standard-table"> + <thead> + <tr> + <th scope="col">仕様書</th> + <th scope="col">状態</th> + </tr> + </thead> + <tbody> + <tr> + <td>{{SpecName('Shadow DOM','#dom-documentorshadowroot-elementsfrompoint','elementsFromPoint()')}}</td> + <td>{{Spec2('Shadow DOM')}}</td> + </tr> + <tr> + <td>{{SpecName('CSSOM View', '#dom-document-elementsfrompoint', 'elementsFromPoint()')}}</td> + <td>{{Spec2('CSSOM View')}}</td> + </tr> + </tbody> +</table> + +<h2 id="Browser_compatibility" name="Browser_compatibility">ブラウザーの互換性</h2> + +<div class="hidden">このページの互換性一覧表は構造化データから生成されています。データに協力していただけるのであれば、 <a class="external" href="https://github.com/mdn/browser-compat-data">https://github.com/mdn/browser-compat-data</a> をチェックアウトしてプルリクエストを送信してください。</div> + +<p>{{Compat("api.DocumentOrShadowRoot.elementsFromPoint")}}</p> + +<h2 id="See_also" name="See_also">関連情報</h2> + +<ul> + <li>{{DOMxRef("DocumentOrShadowRoot.elementFromPoint()")}}</li> + <li>{{DOMxRef("DocumentOrShadowRoot.msElementsFromRect()")}} {{Non-standard_Inline}}</li> +</ul> |