committed by
GitHub
1 changed files with 6 additions and 2 deletions
@ -1,6 +1,10 @@ |
|||
/** |
|||
* Returns the parent node of the given element or the document body if the element is not provided.it |
|||
* If the node is holding inside a form, return the form element, |
|||
* otherwise return the parent node of the given element or |
|||
* the document body if the element is not provided. |
|||
*/ |
|||
export function getPopupContainer(node?: HTMLElement): HTMLElement { |
|||
return (node?.parentNode as HTMLElement) ?? document.body; |
|||
return ( |
|||
node?.closest('form') ?? (node?.parentNode as HTMLElement) ?? document.body |
|||
); |
|||
} |
|||
|
|||
Loading…
Reference in new issue