/**
 * Finds the closest parent element of the given element that has the specified attribute set,
 * and returns the value of that attribute.
 *
 * @param {HTMLElement} element - The starting element to search from.
 * @param {string} attribute - The attribute to search for.
 * @returns {string | null} The value of the specified attribute on the closest parent element that has it set, or null if no such parent element is found.
 */
export const findParentAttribute = (element, attribute) => {
    if (!element) {
        return null;
    }
    let { parentElement } = element;
    while (parentElement) {
        const dir = parentElement.getAttribute(attribute);
        if (dir) {
            return dir;
        }
        parentElement = parentElement === null || parentElement === void 0 ? void 0 : parentElement.parentElement;
    }
    return null;
};
//# sourceMappingURL=findParentAttribute.js.map