--- title: DocumentOrShadowRoot.nodesFromPoint() slug: Web/API/DocumentOrShadowRoot/nodesFromPoint tags: - API - DocumentOrShadowRoot - Method - Non-standard - Reference - nodesFromPoint - メソッド translation_of: Web/API/DocumentOrShadowRoot translation_of_original: Web/API/DocumentOrShadowRoot/nodesFromPoint ---
{{domxref("DocumentOrShadowRoot")}} インターフェイスの nodesFromPoint() プロパティは、 (ビューポートからの相対で) 指定された座標のすべてのノードの配列を返します。
現在のところ、このメソッドは Firefox でしか実装されておらず、クロムコードでのみ利用できます。
var nodes = document.nodesFromPoint(x, y);
{{domxref('Node')}} オブジェクトの配列。
<div> <p>Some text</p> </div> <p>Nodes at point 30, 20:</p> <div id="output"></div>
var output = document.getElementById("output");
if (document.nodesFromPoint) {
var nodes = document.nodesFromPoint(30, 20);
for(var i = 0; i < nodes.length; i++) {
output.textContent += nodes[i].localName;
if (i < nodes.length - 1) {
output.textContent += " < ";
}
}
} else {
output.innerHTML = "<span style=\"color: red;\">" +
"Browser does not support <code>document.nodesFromPoint()</code>" +
"</span>";
}
{{EmbedLiveSample('Example', '420', '120')}}
現在はどの仕様書にも含まれていません。
{{Compat("api.DocumentOrShadowRoot.nodesFromPoint")}}