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

Function describeRNode

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

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

(rNode: RNode, innerContent: string = '…')

Source from the content-addressed store, hash-verified

316 * @returns string
317 */
318function describeRNode(rNode: RNode, innerContent: string = '…'): string {
319 const node = rNode as HTMLElement;
320 switch (node.nodeType) {
321 case Node.ELEMENT_NODE:
322 const tag = node.tagName!.toLowerCase();
323 const attrs = stringifyRNodeAttrs(node);
324 return `<${tag}${attrs ? ' ' + attrs : ''}>${innerContent}</${tag}>`;
325 case Node.TEXT_NODE:
326 const content = node.textContent ? shorten(node.textContent) : '';
327 return `#text${content ? `(${content})` : ''}`;
328 case Node.COMMENT_NODE:
329 return `<!-- ${shorten(node.textContent ?? '')} -->`;
330 default:
331 return `#node(${node.nodeType})`;
332 }
333}
334
335/**
336 * Builds the string containing the expected DOM present given the LView and TNode

Callers 3

nodeNotFoundAtPathErrorFunction · 0.85
describeExpectedDomFunction · 0.85
describeDomFromNodeFunction · 0.85

Calls 2

stringifyRNodeAttrsFunction · 0.85
shortenFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…