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

Function shortRNodeDescription

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

* Shortens the description of a given RNode by its type for readability * * @param nodeType the type of node * @param tagName the node tag name * @param textContent the text content in the node * @returns string

(
  nodeType: number,
  tagName: string | null,
  textContent: string | null,
)

Source from the content-addressed store, hash-verified

399 * @returns string
400 */
401function shortRNodeDescription(
402 nodeType: number,
403 tagName: string | null,
404 textContent: string | null,
405): string {
406 switch (nodeType) {
407 case Node.ELEMENT_NODE:
408 return `<${tagName!.toLowerCase()}>`;
409 case Node.TEXT_NODE:
410 const content = textContent ? ` (with the "${shorten(textContent)}" content)` : '';
411 return `a text node${content}`;
412 case Node.COMMENT_NODE:
413 return 'a comment node';
414 default:
415 return `#node(nodeType=${nodeType})`;
416 }
417}
418
419/**
420 * Builds the footer hydration error message

Callers 1

validateMatchingNodeFunction · 0.85

Calls 1

shortenFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…