Build NapCat Artifacts / Windows Loader Test (push) Canceled after 0s
Build NapCat Artifacts / Type Check & Test (push) Canceled after 0s
Build NapCat Artifacts / Build NapCat.Framework (push) Canceled after 0s
Build NapCat Artifacts / Build NapCat.Shell (push) Canceled after 0s
15 lines
422 B
Plaintext
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;
|
|
};
|