( node: string | TemplateChildNode, context: TransformContext, )
| 293 | } |
| 294 | |
| 295 | function 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 | |
| 324 | function stringifyElement( |
| 325 | node: ElementNode, |
no test coverage detected