document.elementFromPoint() and document.elementsFromPoint()Baseline · Widely available
The document.elementFromPoint() and document.elementsFromPoint() methods find the top-most element at a given point in the viewport, or all elements at a given point in the viewport, respectively.
Supported in all major browsers for at least 30 months — safe to use without fallbacks. Baseline since Jan 15, 2020. Widely available since Jul 15, 2022.
Browser support
DesktopChrome
1–42Not supported
43+Supportedsince May 19, 2015
Current: 155Edge
12–18Not supported
79+Supportedsince Jan 15, 2020
Current: 154Firefox
1–45Not supported
46+Supportedsince Apr 26, 2016
Current: 157Safari
1–11Not supported
11.1+Supportedsince Apr 12, 2018
Current: 27MobileChrome Android
18–42Not supported
43+Supportedsince May 27, 2015
Current: 155Firefox Android
4–45Not supported
46+Supportedsince Apr 26, 2016
Current: 157Safari iOS
1–11Not supported
11.3+Supportedsince Mar 29, 2018
Current: 27How to use
This feature is Baseline widely available — use it freely, no fallback needed.
Example
Full syntax and examples are on MDN: elementFromPoint.
Feature detection
JS · check before using
if ("Document" in globalThis && "elementFromPoint" in Document.prototype) {
// Document.elementFromPoint is available
}Documentation (MDN)
Specification
Usage share
Sub-features
Support for each part of the feature (2). The overall table above shows when the whole feature works.
| Sub-feature | Chrome | Edge | Firefox | Safari | Chrome Android | Firefox Android | Safari iOS |
|---|---|---|---|---|---|---|---|
| Document.elementFromPoint | 1 | 12 | 3 | 4 | 18 | 4 | 3.2 |
| Document.elementsFromPoint | 43 | 79 | 46 | 11.1 | 43 | 46 | 11.3 |