* 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, )
| 399 | * @returns string |
| 400 | */ |
| 401 | function 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 |
no test coverage detected
searching dependent graphs…