![]() | Name | Last modified | Size | Description |
---|---|---|---|---|
![]() | Parent Directory | - | ||
![]() | component.json | 12 years ago | 244 | |
![]() | index.js | 12 years ago | 302 | |
![]() | package.json | 2 years ago | 1.3K | 7375cab EXHIBTION: fix overflow ellipsis cutoff [كارل مبارك] |
![]() | README.md | 12 years ago | 733 | f12eb36 documentaiton updates [كارل مبارك] |
Similar to jQuery's $.fn.closest
and $.fn.parents
.
Finds the closest parent that matches a selector.
$ npm install closest
closest(element, selector, checkSelf)
element
.
If falsey, will begin with element.parentNode
and is synonymous to $.fn.parents
.
Otherwise, it's $.fn.closest
.Example:
var closest = require('cosest');
closest(document.body, 'html') === document.documentElement
closest(document.body, 'body', true) === document.body
closest(document.documentElement, 'html') == null
MIT