closest-element
Find the closest element that matches a selector or an element
Usage
element
, the first element.
selectorOrElement
, a string of selector expression or an element to match elements against.
rootElement
, if matches current element, this function will stop traversing up.
excludeSelf
, whether skip self from matching.
Returns matched element, or null
if no element found.
Example:
Home About Contact Us
// returns <ul> // returns null // <li> // false // <nav>
Files
src/
- cloest.js // in es6
dist/
- closest.cjs.js // CMD
- closest.es6.js // ES6 module, compiled with Buble
- closest.js // UMD