Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

Revision 961307 of Document.elementsFromPoint()

  • Revision slug: Web/API/Document/elementsFromPoint
  • Revision title: Document.elementsFromPoint()
  • Revision id: 961307
  • Created:
  • Creator: Sebastianz
  • Is current revision? No
  • Comment Fixed page formatting, so that the compat data scraper can parse the page and set correct tags
Tags: 

Revision Content

{{APIRef("DOM")}}{{SeeCompatTable}}

The elementsFromPoint() method of the {{domxref("Document")}} interface returns an array of all elements at the specified coordinates.

Syntax

var elements[] = document.elementsFromPoint(x, y);

Returns

An array of {{domxref("Element")}} objects under the given point.

Parameters

x
A horizontal position within the current viewport.
y
A vertical position within the current viewport.

Example

//TBD

Specifications

Specification Status Comment
{{SpecName('CSSOM View', '#dom-document-elementsfrompoint', 'elementsFromPoint')}} {{Spec2('CSSOM View')}} Initial definition.

Browser compatibility

{{CompatibilityTable}}

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
Basic support  {{CompatChrome(43.0)}} {{CompatUnknown}} [1] 10.0 {{property_prefix("ms")}} {{CompatUnknown}} {{CompatNo}}
Feature Android Android Webview Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile Chrome for Android
Basic support {{CompatNo}} {{CompatChrome(43.0)}} {{CompatUnknown}} [1] {{CompatUnknown}} {{CompatUnknown}} {{CompatNo}} {{CompatChrome(43.0)}}

[1] See {{bug(1164427)}}

Revision Source

<div>{{APIRef("DOM")}}{{SeeCompatTable}}</div>

<p>The <code><strong>elementsFromPoint()</strong></code> method of the {{domxref("Document")}} interface returns an array of all elements at the specified coordinates.</p>

<h2 id="Syntax">Syntax</h2>

<pre class="brush: js">
var<em> elements[]</em> = <em>document</em>.elementsFromPoint(<em>x</em>, <em>y</em>);</pre>

<h3 id="Returns">Returns</h3>

<p>An array of {{domxref("Element")}} objects under the given point.</p>

<h3 id="Parameters">Parameters</h3>

<dl>
 <dt>x</dt>
 <dd>A horizontal position within the current viewport.</dd>
 <dt>y</dt>
 <dd>A vertical position within the current viewport.</dd>
</dl>

<h2 id="Example">Example</h2>

<pre class="brush:html">
//TBD</pre>

<h2 id="Specifications">Specifications</h2>

<table class="standard-table">
 <tbody>
  <tr>
   <th scope="col">Specification</th>
   <th scope="col">Status</th>
   <th scope="col">Comment</th>
  </tr>
  <tr>
   <td>{{SpecName('CSSOM View', '#dom-document-elementsfrompoint', 'elementsFromPoint')}}</td>
   <td>{{Spec2('CSSOM View')}}</td>
   <td>Initial definition.</td>
  </tr>
 </tbody>
</table>

<h2 id="Browser_compatibility">Browser compatibility</h2>

<p>{{CompatibilityTable}}</p>

<div id="compat-desktop">
<table class="compat-table">
 <tbody>
  <tr>
   <th>Feature</th>
   <th>Chrome</th>
   <th>Firefox (Gecko)</th>
   <th>Internet Explorer</th>
   <th>Opera</th>
   <th>Safari</th>
  </tr>
  <tr>
   <td>Basic support</td>
   <td>&nbsp;{{CompatChrome(43.0)}}</td>
   <td>{{CompatUnknown}} [1]</td>
   <td>10.0 {{property_prefix("ms")}}</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatNo}}</td>
  </tr>
 </tbody>
</table>
</div>

<div id="compat-mobile">
<table class="compat-table">
 <tbody>
  <tr>
   <th>Feature</th>
   <th>Android</th>
   <th>Android Webview</th>
   <th>Firefox Mobile (Gecko)</th>
   <th>IE Mobile</th>
   <th>Opera Mobile</th>
   <th>Safari Mobile</th>
   <th>Chrome for Android</th>
  </tr>
  <tr>
   <td>Basic support</td>
   <td>{{CompatNo}}</td>
   <td>{{CompatChrome(43.0)}}</td>
   <td>{{CompatUnknown}} [1]</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatNo}}</td>
   <td>{{CompatChrome(43.0)}}</td>
  </tr>
 </tbody>
</table>
</div>

<p>[1] See {{bug(1164427)}}</p>
Revert to this revision