* Builds the string containing the DOM present around a given RNode for a * readable error message * * @param node the RNode * @returns string
(node: RNode)
| 373 | * @returns string |
| 374 | */ |
| 375 | function describeDomFromNode(node: RNode): string { |
| 376 | const spacer = ' '; |
| 377 | let content = ''; |
| 378 | const currentNode = node as HTMLElement; |
| 379 | if (currentNode.previousSibling) { |
| 380 | content += spacer + '…\n'; |
| 381 | content += spacer + describeRNode(currentNode.previousSibling) + '\n'; |
| 382 | } |
| 383 | content += spacer + describeRNode(currentNode) + ` ${AT_THIS_LOCATION}\n`; |
| 384 | if (node.nextSibling) { |
| 385 | content += spacer + '…\n'; |
| 386 | } |
| 387 | if (node.parentNode) { |
| 388 | content = describeRNode(currentNode.parentNode as Node, '\n' + content); |
| 389 | } |
| 390 | return content; |
| 391 | } |
| 392 | |
| 393 | /** |
| 394 | * Shortens the description of a given RNode by its type for readability |
no test coverage detected
searching dependent graphs…