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

Function getSingleElementRoot

packages/compiler-core/src/transforms/cacheStatic.ts:51–60  ·  view source on GitHub ↗
(
  root: RootNode,
)

Source from the content-addressed store, hash-verified

49}
50
51export function getSingleElementRoot(
52 root: RootNode,
53): PlainElementNode | ComponentNode | TemplateNode | null {
54 const children = root.children.filter(x => x.type !== NodeTypes.COMMENT)
55 return children.length === 1 &&
56 children[0].type === NodeTypes.ELEMENT &&
57 !isSlotOutlet(children[0])
58 ? children[0]
59 : null
60}
61
62function walk(
63 node: ParentNode,

Callers 2

createRootCodegenFunction · 0.90
cacheStaticFunction · 0.85

Calls 2

isSlotOutletFunction · 0.90
filterMethod · 0.65

Tested by

no test coverage detected