Socket
Socket
Sign inDemoInstall

find-my-el

Package Overview
Dependencies
0
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.1.6 to 2.0.0

dist/find-my-el.cjs.js

67

package.json
{
"name": "find-my-el",
"version": "1.1.6",
"version": "2.0.0",
"description": "Locates the DOM element closest to a given set of coordinates",
"main": "index.js",
"main": "dist/find-my-el.cjs.js",
"module": "dist/find-my-el.es.js",
"unpkg": "dist/find-my-el.min.js",
"files": [
"index.umd.js"
"dist"
],
"scripts": {
"build:all": "npm run build && npm run build:umd",
"build": "BUILD_ENV=cjs rollup -c",
"build:umd": "BUILD_ENV=umd rollup -c && cp index.umd.js demo",
"test": "karma start karma.conf.js --single-run true --auto-watch false",
"version": "npm run build:all && git add index.js index.umd.js demo/index.umd.js && git commit -m 'Version Build'",
"postversion": "git push"
"build": "bili",
"test": "jest",
"watch-test": "jest --watchAll",
"example": "poi example/index.js",
"example:build": "rm -rf example/dist && poi build",
"example:deploy": "git subtree push --prefix example/dist origin gh-pages"
},

@@ -23,29 +25,30 @@ "keywords": [

],
"author": {
"name": "Collin Henderson",
"email": "collin@syropia.net",
"url": "http://syropia.net"
"author": "Collin Henderson <collin@syropia.net>",
"license": "MIT",
"repository": "https://github.com/syropian/find-my-el",
"bili": {
"format": [
"cjs",
"umd-min",
"es"
],
"moduleName": "FindMyEl"
},
"engines": {
"node": ">=4"
"poi": {
"entry": "example/index.js",
"outDir": "example/dist",
"publicPath": "/find-my-el/"
},
"license": "MIT",
"repository": "syropian/find-my-el",
"devDependencies": {
"babel-core": "^6.18.2",
"babel-plugin-transform-runtime": "^6.15.0",
"babel-preset-es2015": "^6.18.0",
"babel-preset-es2015-rollup": "^1.2.0",
"babel-runtime": "^6.18.0",
"jasmine-core": "^2.5.2",
"jquery": "^3.1.1",
"karma": "^1.3.0",
"karma-jasmine": "^1.0.2",
"karma-phantomjs-launcher": "^1.0.2",
"karma-spec-reporter": "^0.0.26",
"phantomjs-prebuilt": "^2.1.13",
"rollup": "^0.36.3",
"rollup-plugin-babel": "^2.6.1",
"rollup-plugin-uglify": "^1.0.1"
"@babel/core": "^7.0.0-beta.44",
"@babel/plugin-proposal-object-rest-spread": "^7.0.0-beta.44",
"babel-core": "^7.0.0-0",
"babel-jest": "^22.4.3",
"babel-preset-env": "^1.6.1",
"bili": "^3.0.15",
"jest": "^22.4.3",
"jquery": "^3.3.1",
"poi": "^10.0.0-beta.6",
"vue-draggable-resizable": "^1.7.1"
}
}
# find-my-el [![Build Status](https://travis-ci.org/syropian/find-my-el.svg?branch=master)](https://travis-ci.org/syropian/find-my-el)
> Locates the DOM element closest to a given set of coordinates
> Locates the DOM element closest to a given set of coordinates.
## Install
```
```bash
$ yarn add find-my-el

@@ -13,3 +13,3 @@ ```

```
```bash
npm install find-my-el --save

@@ -20,11 +20,11 @@ ```

https://unpkg.com/find-my-el/index.umd.js
https://unpkg.com/find-my-el/find-my-el.min.js
## Usage
```
import findMyEl from 'find-my-el'
```js
import findMyEl from "find-my-el"
const nodes = document.querySelectorAll('.item')
findMyEl('CENTER', nodes)
const nodes = document.querySelectorAll(".item")
findMyEl("CENTER", nodes)

@@ -36,2 +36,5 @@ // or

```
**Note:** If you're using the UMD build in a `<script>` tag, the module is available under `FindMyEl`.
## API

@@ -42,2 +45,3 @@

#### position
Type: `string` or `array`

@@ -48,2 +52,3 @@

#### nodes
Type: `NodeList`

@@ -56,2 +61,3 @@

##### container
Type: `Element`

@@ -64,2 +70,3 @@

##### axis
Type: `string`

@@ -71,3 +78,2 @@

### Position Keywords

@@ -78,14 +84,30 @@

**Keywords**:
- `CENTER`
- `LEFT_TOP`
- `RIGHT_TOP`
- `CENTER_TOP`
- `LEFT_CENTER`
- `RIGHT_CENTER`
- `LEFT_BOTTOM`
- `RIGHT_BOTTOM`
- `CENTER_BOTTOM`
* `CENTER`
* `LEFT_TOP`
* `RIGHT_TOP`
* `CENTER_TOP`
* `LEFT_CENTER`
* `RIGHT_CENTER`
* `LEFT_BOTTOM`
* `RIGHT_BOTTOM`
* `CENTER_BOTTOM`
## How is this different from `document.getElementAtPoint`?
`find-my-el` has some key differences that sets it apart from the native `document.getElementAtPoint` function. The first is it lets you restrict your search to a specific list of DOM nodes. This lets you avoid issues such as a resulting node ending up being a parent element instead of a child node that you're trying to target. The other difference is `find-my-el` looks for the _closest_ element to the coordinates — even if it's not actually touching them. You can also pass in a custom container to restrict the bounds of your search, instead of checking the entire viewport.
`find-my-el` has some key differences that sets it apart from the native `document.getElementAtPoint` function. The first is it lets you restrict your search to a specific list of DOM nodes. This lets you avoid issues such as a resulting node ending up being a parent element instead of a child node that you're trying to target. The other difference is `find-my-el` looks for the _closest_ element to the coordinates — even if it's not actually touching them. You can also pass in a custom container to restrict the bounds of your search, instead of checking the entire viewport.
## Development
```bash
# To run the example
$ npm run example
# To run the tests
$ npm test
# To publish the dist file
$ npm run build
```
MIT © [Collin Henderson](https://github.com/syropian)
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc