closest

WebJar for closest

License

License

MIT
GroupId

GroupId

org.webjars.npm
ArtifactId

ArtifactId

closest
Last Version

Last Version

0.0.1
Release Date

Release Date

Type

Type

jar
Description

Description

closest
WebJar for closest
Project URL

Project URL

http://webjars.org
Source Code Management

Source Code Management

https://github.com/ForbesLindesay/closest

Download closest

How to add to project

<!-- https://jarcasting.com/artifacts/org.webjars.npm/closest/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>closest</artifactId>
    <version>0.0.1</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/closest/
implementation 'org.webjars.npm:closest:0.0.1'
// https://jarcasting.com/artifacts/org.webjars.npm/closest/
implementation ("org.webjars.npm:closest:0.0.1")
'org.webjars.npm:closest:jar:0.0.1'
<dependency org="org.webjars.npm" name="closest" rev="0.0.1">
  <artifact name="closest" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='closest', version='0.0.1')
)
libraryDependencies += "org.webjars.npm" % "closest" % "0.0.1"
[org.webjars.npm/closest "0.0.1"]

Dependencies

compile (1)

Group / Artifact Type Version
org.webjars.npm : matches-selector jar 0.0.1

Project Modules

There are no modules declared in this project.

Closest

Finds the closest parent that matches a selector. Like jQuery.fn.closest

Installation

$ npm install closest

API

closest(element, selector, checkSelf)

  • element - element to search from
  • selector - CSS selector to match parents
  • checkSelf
    • If falsey (default) it starts with the parent like $(element).closest(selector)
    • If truthy it starts with itself so would return element if it matches selector

Example:

var closest = require('closest');

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

License

MIT

Versions

Version
0.0.1