(dir, node, context)
| 6 | import { DOMErrorCodes, createDOMCompilerError } from '../errors' |
| 7 | |
| 8 | export 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 | } |
nothing calls this directly
no test coverage detected