Files
NapCatQQ/.pnpm-store/v3/files/9e/15ed816f585d08162278356281604e3e22263f8006259f4b6d205bd79dbfdb1fa7ade190a7cfb734ad78da6ac8374c0b8f2ba828872387f0c688268572df8d
T
TanTan e311ca3275
Build NapCat Artifacts / Type Check & Test (push) Waiting to run
docs: 仓库链接指向本镜像仓库
2026-11-13 09:25:58 +08:00

15 lines
422 B
Plaintext

export const getOwnerDocument = (el: Element | null | undefined): Document => {
return el?.ownerDocument ?? document;
};
export const getOwnerWindow = (
el: (Window & typeof global) | Element | null | undefined
): Window & typeof global => {
if (el && 'window' in el && el.window === el) {
return el;
}
const doc = getOwnerDocument(el as Element | null | undefined);
return doc.defaultView || window;
};