Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

element-closest

Package Overview
Dependencies
Maintainers
2
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

element-closest - npm Package Compare versions

Comparing version 3.0.1 to 3.0.2

4

CHANGELOG.md
# Changes to closest
### 3.0.2 (October 31, 2019)
- Improved how the file is distributed to Node and Web environments.
### 3.0.1 (February 5, 2018)

@@ -4,0 +8,0 @@

12

index.js

@@ -1,11 +0,9 @@

'use strict';
function polyfill(window) {
const ElementPrototype = window.Element.prototype;
var ElementPrototype = window.Element.prototype;
if (typeof ElementPrototype.matches !== 'function') {
ElementPrototype.matches = ElementPrototype.msMatchesSelector || ElementPrototype.mozMatchesSelector || ElementPrototype.webkitMatchesSelector || function matches(selector) {
let element = this;
const elements = (element.document || element.ownerDocument).querySelectorAll(selector);
let index = 0;
var element = this;
var elements = (element.document || element.ownerDocument).querySelectorAll(selector);
var index = 0;

@@ -22,3 +20,3 @@ while (elements[index] && elements[index] !== element) {

ElementPrototype.closest = function closest(selector) {
let element = this;
var element = this;

@@ -25,0 +23,0 @@ while (element && element.nodeType === 1) {

{
"name": "element-closest",
"version": "3.0.1",
"version": "3.0.2",
"description": "Return the closest element matching a selector up the DOM tree",

@@ -12,2 +12,4 @@ "author": "Jonathan Neal <jonathantneal@hotmail.com>",

"module": "index.mjs",
"unpkg": "browser.js",
"jsdelivr": "browser.js",
"files": [

@@ -18,4 +20,3 @@ "browser.js",

"index.mjs",
"index.mjs.map",
"browser.js"
"index.mjs.map"
],

@@ -30,15 +31,15 @@ "scripts": {

"engines": {
"node": ">=6.0.0"
"node": ">=0.12.0"
},
"devDependencies": {
"@babel/core": "^7.2.2",
"@babel/preset-env": "^7.3.1",
"babel-eslint": "^10.0.1",
"cross-env": "^5.2.0",
"eslint": "^5.13.0",
"@babel/core": "^7.6.4",
"@babel/preset-env": "^7.6.3",
"babel-eslint": "^10.0.3",
"cross-env": "^6.0.3",
"eslint": "^6.6.0",
"eslint-config-dev": "^2.0.0",
"pre-commit": "^1.2.2",
"rollup": "^1.1.2",
"rollup-plugin-babel": "^4.3.2",
"rollup-plugin-terser": "^4.0.4"
"rollup": "^1.26.0",
"rollup-plugin-babel": "^4.3.3",
"rollup-plugin-terser": "^5.1.2"
},

@@ -50,5 +51,4 @@ "eslintConfig": {

"keywords": [
"postcss",
"css",
"postcss-plugin",
"javascript",
"js",
"dom",

@@ -55,0 +55,0 @@ "document",

@@ -1,6 +0,6 @@

# closest [<img src="https://jonathantneal.github.io/dom-logo.svg" alt="closest" width="90" height="90" align="right">][closest]
# closest [<img src="https://jonneal.dev/dom-logo.svg" alt="closest" width="90" height="90" align="right">][closest]
[![NPM Version][npm-img]][npm-url]
[![Build Status][cli-img]][cli-url]
[![Support Chat][git-img]][git-url]
[<img alt="npm version" src="https://img.shields.io/npm/v/element-closest.svg" height="20">](https://www.npmjs.com/package/element-closest)
[<img alt="build status" src="https://img.shields.io/travis/jonathantneal/closest/master.svg" height="20">](https://travis-ci.org/jonathantneal/closest)
[<img alt="support chat" src="https://img.shields.io/badge/support-chat-blue.svg" height="20">](https://gitter.im/postcss/postcss)

@@ -13,5 +13,3 @@ [closest] is a polyfill for [`#Element.closest`].

The [`#Element.closest`] method returns the closest element that matches a
selector. It returns the element itself, one of its ancestor, or `null` if
there isn't any match.
The [`#Element.closest`] method returns the closest element that matches a selector. It returns the element itself, one of its ancestor, or `null` if there isn't any match.

@@ -36,3 +34,3 @@ ```js

The script is approximately 258 bytes when minified and gzipped.
The script is approximately 428 bytes, or 257 bytes when gzipped.

@@ -44,6 +42,6 @@ ## Usage

```html
<script src="https://unpkg.com/element-closest/browser"></script>
<script src="https://unpkg.com/element-closest"></script>
```
For Node usage, run [closest] with your `window` object:
For usage in Node, including Browserify and Webpack, run [closest] with your `window` object:

@@ -73,9 +71,7 @@ ```js

`closest` is especially useful for delegating events, but remember that
Internet Explorer 8 does not support [`#Element.addEventListener`].
`closest` is especially useful for delegating events, but remember that Internet Explorer 8 does not support [`#Element.addEventListener`].
## matches
This library also polyfills [`#Element.matches`], which is widely supported but
often vendor-prefixed.
This library also polyfills [`#Element.matches`], which is widely supported but often vendor-prefixed.

@@ -86,4 +82,3 @@ ```js

`matches` is especially useful for short-handing `hasAttribute` or
`classList.contains` with selectors.
`matches` is especially useful for short-handing `hasAttribute` or `classList.contains` with selectors.

@@ -98,9 +93,2 @@ ```js

[cli-img]: https://img.shields.io/travis/jonathantneal/closest/master.svg
[cli-url]: https://travis-ci.org/jonathantneal/closest
[git-img]: https://img.shields.io/badge/support-chat-blue.svg
[git-url]: https://gitter.im/postcss/postcss
[npm-img]: https://img.shields.io/npm/v/element-closest.svg
[npm-url]: https://www.npmjs.com/package/element-closest
[`#Element.closest`]: https://dom.spec.whatwg.org/#dom-element-closest

@@ -107,0 +95,0 @@ [`#Element.matches`]: https://dom.spec.whatwg.org/#dom-element-matches

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc