office-ui-fabric-react
Version:
Reusable React components for building experiences for Office 365.
34 lines (33 loc) • 1.24 kB
TypeScript
/**
* Sets the virtual parent of an element.
* Pass `undefined` as the `parent` to clear the virtual parent.
*
* @export
* @param {HTMLElement} child
* @param {HTMLElement} parent
*/
export declare function setVirtualParent(child: HTMLElement, parent: HTMLElement): void;
export declare function getVirtualParent(child: HTMLElement): HTMLElement;
/**
* Gets the element which is the parent of a given element.
* If `allowVirtuaParents` is `true`, this method prefers the virtual parent over
* real DOM parent when present.
*
* @export
* @param {HTMLElement} child
* @param {boolean} [allowVirtualParents=true]
* @returns {HTMLElement}
*/
export declare function getParent(child: HTMLElement, allowVirtualParents?: boolean): HTMLElement;
/**
* Determines whether or not a parent element contains a given child element.
* If `allowVirtualParents` is true, this method may return `true` if the child
* has the parent in its virtual element hierarchy.
*
* @export
* @param {HTMLElement} parent
* @param {HTMLElement} child
* @param {boolean} [allowVirtualParents=true]
* @returns {boolean}
*/
export declare function elementContains(parent: HTMLElement, child: HTMLElement, allowVirtualParents?: boolean): boolean;