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

Function transformVHtml

packages/compiler-dom/src/transforms/vHtml.ts:8–29  ·  view source on GitHub ↗
(dir, node, context)

Source from the content-addressed store, hash-verified

6import { DOMErrorCodes, createDOMCompilerError } from '../errors'
7
8export const transformVHtml: DirectiveTransform = (dir, node, context) => {
9 const { exp, loc } = dir
10 if (!exp) {
11 context.onError(
12 createDOMCompilerError(DOMErrorCodes.X_V_HTML_NO_EXPRESSION, loc),
13 )
14 }
15 if (node.children.length) {
16 context.onError(
17 createDOMCompilerError(DOMErrorCodes.X_V_HTML_WITH_CHILDREN, loc),
18 )
19 node.children.length = 0
20 }
21 return {
22 props: [
23 createObjectProperty(
24 createSimpleExpression(`innerHTML`, true, loc),
25 exp || createSimpleExpression('', true),
26 ),
27 ],
28 }
29}

Callers

nothing calls this directly

Calls 3

createDOMCompilerErrorFunction · 0.90
createObjectPropertyFunction · 0.90
createSimpleExpressionFunction · 0.90

Tested by

no test coverage detected