feat: 初始化项目基础结构和配置
This commit is contained in:
10
packages/utils/src/helpers/get-popup-container.ts
Normal file
10
packages/utils/src/helpers/get-popup-container.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
/**
|
||||
* 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?.closest('form') ?? (node?.parentNode as HTMLElement) ?? document.body
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user