Socket
Book a DemoInstallSign in
Socket

element-from-point

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

element-from-point

A consistent cross-browser document.elementFromPoint function. Works around idiosyncracies of old WebKits et al.

1.0.0
latest
Source
npmnpm
Version published
Weekly downloads
21
-8.7%
Maintainers
1
Weekly downloads
 
Created
Source

ElementFromPoint.js

NPM version

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.

Further reading

Installing

Installing on Node.js

npm install element-from-point

Using

Require 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)
})

License

ElementFromPoint.js is released under a Lesser GNU Affero General Public License, which in summary means:

  • You can use this program for no cost.
  • You can use this program for both personal and commercial reasons.
  • You do not have to share your own program's code which uses this program.
  • You have to share modifications (e.g bug-fixes) you've made to this program.

For more convoluted language, see the LICENSE file.

About

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.

Keywords

browser

FAQs

Package last updated on 26 Jun 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.