UNPKG

@dnb/eufemia

Version:

DNB Eufemia Design System UI Library

12 lines (11 loc) 670 B
export type TargetSelector = string; export type RootElement = Element; /** * getClosestParent returns the first element that matches the `selector` starting with the given `element` and traversing up through its parent. * * @param {string} selector CSS class or tag name (tag name with upper case chars, like "BUTTON") * @param {Element} element The element to begin with * @param {boolean} excludeSelf Whether to exclude the given element itself from the search. Default: `false`. * @return {Element} Found element or `null` */ export declare const getClosestParent: (selector: TargetSelector, element: RootElement, excludeSelf?: boolean) => Element | null;