MCPcopy
hub / github.com/vuejs/core / normalizeContainer

Function normalizeContainer

packages/runtime-dom/src/index.ts:234–257  ·  view source on GitHub ↗
(
  container: Element | ShadowRoot | string,
)

Source from the content-addressed store, hash-verified

232}
233
234function normalizeContainer(
235 container: Element | ShadowRoot | string,
236): Element | ShadowRoot | null {
237 if (isString(container)) {
238 const res = document.querySelector(container)
239 if (__DEV__ && !res) {
240 warn(
241 `Failed to mount app: mount target selector "${container}" returned null.`,
242 )
243 }
244 return res
245 }
246 if (
247 __DEV__ &&
248 window.ShadowRoot &&
249 container instanceof window.ShadowRoot &&
250 container.mode === 'closed'
251 ) {
252 warn(
253 `mounting on a ShadowRoot with \`{mode: "closed"}\` may lead to unpredictable bugs`,
254 )
255 }
256 return container as any
257}
258
259// Custom element support
260export {

Callers 1

index.tsFile · 0.85

Calls 3

isStringFunction · 0.90
warnFunction · 0.90
querySelectorMethod · 0.80

Tested by

no test coverage detected