deleight
Version:
A library with 9 modules for writing more expressive web applications with traditional HTML, CSS and JavaScript.
30 lines (29 loc) • 752 B
TypeScript
/**
* Utility functions for getting ancestor elements.
* These can be used for selecting ancestors whether or not
* there are shadow roots in-between.
*
* @module
*/
/**
* Returns the parent node of a given element or shadow root.
* This function is necessary because shadow roots have no
* parents but instead have hosts which may have them.
*
* @example
*
* @param node
* @returns
*/
export declare function parent(node: Element | ShadowRoot): Element;
/**
* Returns the first ancestor that matches the specified selector.
* This function treates the host of a shadow root as its parent.
*
* @example
*
*
* @param element
* @param selector
*/
export declare function selectParent(element: Element, selector: string): Element;