@hitachivantara/uikit-react-core
Version:
UI Kit Core React components.
15 lines (14 loc) • 522 B
JavaScript
//#region src/utils/document.ts
function getDocument() {
return typeof window !== "undefined" ? document : void 0;
}
/** Wrapper around `document.getElementById` */
function getElementById(elementId) {
return elementId && getDocument()?.getElementById(elementId) || void 0;
}
/** Get a container element by id, falling back to document-body */
function getContainerElement(elementId) {
return getElementById(elementId) || getDocument()?.body;
}
//#endregion
export { getContainerElement, getDocument, getElementById };