module.exports = function closest(el, selector) {
    while (el) {
        if (el.matches(selector)) return el; 
        el = el.parentNode;
    }
};

module.exports = function closest(el, selector) {
    while (el) {
        if (el.matches(selector)) return el; 
        el = el.parentElement;
    }
};

Use parentElement so we don't try to match document.