bootstrap-vue-next
Version:
BootstrapVueNext is an early and lovely component library for Vue 3 & Nuxt 3 based on Bootstrap 5 and Typescript.
1 lines • 992 B
Source Map (JSON)
{"version":3,"file":"getElement-WfnRgCbF.mjs","sources":["../src/utils/getElement.ts"],"sourcesContent":["import type {ComponentPublicInstance} from 'vue'\n\nexport const getElement = (\n element: string | Readonly<ComponentPublicInstance> | Readonly<HTMLElement> | null,\n root: HTMLElement | Document = document\n): HTMLElement | undefined => {\n if (!element) return undefined\n if (typeof element === 'string') {\n if (typeof root === 'undefined' || typeof document === 'undefined') return undefined\n const idElement = document.getElementById(element)\n return idElement ?? (root.querySelector(element) as HTMLElement) ?? undefined\n }\n return (element as ComponentPublicInstance).$el ?? element\n}\n"],"names":[],"mappings":"AAEO,MAAM,aAAa,CACxB,SACA,OAA+B,aACH;AACxB,MAAA,CAAC,QAAgB,QAAA;AACjB,MAAA,OAAO,YAAY,UAAU;AAC/B,QAAI,OAAO,SAAS,eAAe,OAAO,aAAa,YAAoB,QAAA;AACrE,UAAA,YAAY,SAAS,eAAe,OAAO;AACjD,WAAO,aAAc,KAAK,cAAc,OAAO,KAAqB;AAAA,EAAA;AAEtE,SAAQ,QAAoC,OAAO;AACrD;"}