"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
const matches_1 = tslib_1.__importDefault(require("./matches"));
exports.default = (selector, node) => {
    if (!node) {
        return null;
    }
    while ((node = node.parentElement)) {
        if (matches_1.default.call(node, selector)) {
            return node;
        }
    }
    return null;
};
