MCPcopy Index your code
hub / github.com/angular/angular / describeTNode

Function describeTNode

packages/core/src/hydration/error_handling.ts:292–309  ·  view source on GitHub ↗

* Converts a tNode to a helpful readable string value for use in error messages * * @param tNode a given TNode * @param innerContent the content of the node * @returns string

(tNode: TNode, innerContent: string = '…')

Source from the content-addressed store, hash-verified

290 * @returns string
291 */
292function describeTNode(tNode: TNode, innerContent: string = '…'): string {
293 switch (tNode.type) {
294 case TNodeType.Text:
295 const content = tNode.value ? `(${tNode.value})` : '';
296 return `#text${content}`;
297 case TNodeType.Element:
298 const attrs = stringifyTNodeAttrs(tNode);
299 const tag = tNode.value.toLowerCase();
300 return `<${tag}${attrs ? ' ' + attrs : ''}>${innerContent}</${tag}>`;
301 case TNodeType.ElementContainer:
302 return '<!-- ng-container -->';
303 case TNodeType.Container:
304 return '<!-- container -->';
305 default:
306 const typeAsString = getFriendlyStringFromTNodeType(tNode.type);
307 return `#node(${typeAsString})`;
308 }
309}
310
311/**
312 * Converts an RNode to a helpful readable string value for use in error messages

Callers 1

describeExpectedDomFunction · 0.85

Calls 2

stringifyTNodeAttrsFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…