{"_id":"closest","_rev":"26078","name":"closest","description":"Find the closest parent that matches a selector.","dist-tags":{"latest":"0.0.1"},"maintainers":[{"name":"forbeslindesay","email":"forbes@lindesay.co.uk"}],"time":{"modified":"2021-06-03T10:02:34.000Z","created":"2013-03-13T17:14:08.915Z","0.0.1":"2013-03-13T17:14:08.915Z"},"users":{"monjer":true,"s4g6":true,"drazik":true,"dralc":true,"seangenabe":true,"npmrud5g":true,"shanewholloway":true},"author":{"name":"Jonathan Ong"},"repository":{"type":"git","url":"https://github.com/ForbesLindesay/closest.git"},"versions":{"0.0.1":{"name":"closest","version":"0.0.1","description":"Find the closest parent that matches a selector.","keywords":["browserify","CSS","selector","closest","parents","jquery"],"dependencies":{"matches-selector":"0.0.1"},"repository":{"type":"git","url":"https://github.com/ForbesLindesay/closest.git"},"author":{"name":"Jonathan Ong"},"license":"MIT","readmeFilename":"README.md","_id":"closest@0.0.1","dist":{"shasum":"26da6f80b3e0e17e71f80f12782819e9f653495c","size":1251,"noattachment":false,"key":"/closest/-/closest-0.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/closest/download/closest-0.0.1.tgz"},"_from":".","_npmVersion":"1.2.10","_npmUser":{"name":"forbeslindesay","email":"forbes@lindesay.co.uk"},"maintainers":[{"name":"forbeslindesay","email":"forbes@lindesay.co.uk"}],"directories":{},"publish_time":1363194848915,"_cnpm_publish_time":1363194848915,"_hasShrinkwrap":false}},"readme":"# Closest\r\n\r\nSimilar to jQuery's `$.fn.closest` and `$.fn.parents`.\r\nFinds the closest parent that matches a selector.\r\n\r\n## Installation\r\n\r\n    $ npm install closest\r\n\r\n## API\r\n\r\n### `closest(element, selector, checkSelf)`\r\n\r\n* element - will check this elements parents\r\n* selector - CSS selector to match parents\r\n* checkSelf - check `element`.\r\n  If falsey, will begin with `element.parentNode` and is synonymous to `$.fn.parents`.\r\n  Otherwise, it's `$.fn.closest`.\r\n\r\nExample:\r\n\r\n```javascript\r\nvar closest = require('cosest');\r\n\r\nclosest(document.body, 'html') === document.documentElement\r\nclosest(document.body, 'body', true) === document.body\r\nclosest(document.documentElement, 'html') == null\r\n```\r\n\r\n## License\r\n\r\n  MIT\r\n","_attachments":{},"readmeFilename":"README.md","license":"MIT"}