Socket
Book a DemoInstallSign in
Socket

closest-ng

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

closest-ng

Find the closest parent that matches a selector.

latest
Source
npmnpm
Version
1.1.0
Version published
Maintainers
1
Created
Source

Closest-ng

GitHub license npm version CircleCI Status Greenkeeper badge

Finds the closest ancestor of an element (or the current element itself) that matches a selector. Uses the native closest method if available in the browser.

Installation

$ yarn add closest-ng

API

closest(element, selector)

  • element - will check this element's parents
  • selector - CSS selector to match parents

Example:

var closest = require('closest-ng');

closest(document.body, 'html') === document.documentElement
closest(document.body, 'body') === document.body

Types

Both TypeScript and Flow type definitions for this module are included! The type definitions won't require any configuration to use.

Keywords

CSS

FAQs

Package last updated on 26 Sep 2018

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