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

Function stringifyNode

packages/compiler-dom/src/transforms/stringifyStatic.ts:295–322  ·  packages/compiler-dom/src/transforms/stringifyStatic.ts::stringifyNode
(
  node: string | TemplateChildNode,
  context: TransformContext,
)

Source from the content-addressed store, hash-verified

293}
294
295function stringifyNode(
296 node: string | TemplateChildNode,
297 context: TransformContext,
298): string {
299 if (isString(node)) {
300 return node
301 }
302 if (isSymbol(node)) {
303 return ``
304 }
305 switch (node.type) {
306 case NodeTypes.ELEMENT:
307 return stringifyElement(node, context)
308 case NodeTypes.TEXT:
309 return escapeHtml(node.content)
310 case NodeTypes.COMMENT:
311 return `<!--${escapeHtml(node.content)}-->`
312 case NodeTypes.INTERPOLATION:
313 return escapeHtml(toDisplayString(evaluateConstant(node.content)))
314 case NodeTypes.COMPOUND_EXPRESSION:
315 return escapeHtml(evaluateConstant(node))
316 case NodeTypes.TEXT_CALL:
317 return stringifyNode(node.content, context)
318 default:
319 class="cm">// static trees will not contain if/for nodes
320 return class="st">''
321 }
322}
323
324function stringifyElement(
325 node: ElementNode,

Callers 2

stringifyCurrentChunkFunction · 0.85
stringifyElementFunction · 0.85

Calls 6

isStringFunction · 0.90
isSymbolFunction · 0.90
escapeHtmlFunction · 0.90
toDisplayStringFunction · 0.90
stringifyElementFunction · 0.85
evaluateConstantFunction · 0.85

Tested by

no test coverage detected