package
A consistent cross-browser document.elementFromPoint function. Works around idiosyncracies of old WebKits et al.
npm install element-from-pointGitHub-flavored package documentation.
Across all versions.
Download trend unavailable.
Runtime metadata.
Tagged topics.
ElementFromPoint.js is a cross-browser document.elementFromPoint function that works consistently across browsers that may implement document.elementFromPoint differently.
For example, older iOS or Android devices (with WebKit) implement elementFromPoint such that it takes page (pageX/Y) coordinates, not viewport (clientX/Y) coordinates. Use this function to always work with viewport coordinates.
npm install element-from-pointRequire and use it as you would use document.elementFromPoint.
Just make sure to pass in viewport coordinates and you're all set.
var elementFromPoint = require("element-from-point")
document.addEventListener("mousedown", function(ev) {
var el = elementFromPoint(ev.clientX, ev.clientY)
})ElementFromPoint.js is released under a Lesser GNU Affero General Public License, which in summary means:
For more convoluted language, see the LICENSE file.
Andri Möll typed this and the code.
Monday Calendar supported the engineering work.
If you find ElementFromPoint.js needs improving, ping me at andri@dot.ee or create an issue online.