UNPKG

bootstrap-vue-next

Version:

Seamless integration of Vue 3, Bootstrap 5, and TypeScript for modern, type-safe UI development

1 lines 982 B
{"version":3,"file":"getElement-0_htvrFw.mjs","names":[],"sources":["../src/utils/getElement.ts"],"sourcesContent":["import type {ComponentPublicInstance} from 'vue'\nimport {getSafeDocument} from './dom'\n\nexport const getElement = (\n element: string | Readonly<ComponentPublicInstance> | Readonly<HTMLElement> | null,\n root: HTMLElement | Document | null = getSafeDocument()\n): HTMLElement | undefined => {\n if (!element) return undefined\n if (typeof element === 'string') {\n if (root === null) return undefined\n const idElement = getSafeDocument()?.getElementById(element)\n return idElement ?? (root.querySelector(element) as HTMLElement) ?? undefined\n }\n return (element as ComponentPublicInstance).$el ?? element\n}\n"],"mappings":";;AAGA,IAAa,cACX,SACA,OAAsC,iBAAiB,KAC3B;AAC5B,KAAI,CAAC,QAAS,QAAO,KAAA;AACrB,KAAI,OAAO,YAAY,UAAU;AAC/B,MAAI,SAAS,KAAM,QAAO,KAAA;AAE1B,SADkB,iBAAiB,EAAE,eAAe,QAAQ,IACvC,KAAK,cAAc,QAAQ,IAAoB,KAAA;;AAEtE,QAAQ,QAAoC,OAAO"}