(nodeElement: HTMLElement)
| 1491 | } |
| 1492 | |
| 1493 | function getParentNodeAriaLevel(nodeElement: HTMLElement): number { |
| 1494 | let parent = nodeElement.parentElement; |
| 1495 | while (parent && !isNodeElement(parent)) { |
| 1496 | parent = parent.parentElement; |
| 1497 | } |
| 1498 | if (!parent) { |
| 1499 | if (typeof ngDevMode === 'undefined' || ngDevMode) { |
| 1500 | throw Error('Incorrect tree structure containing detached node.'); |
| 1501 | } else { |
| 1502 | return -1; |
| 1503 | } |
| 1504 | } else if (parent.classList.contains('cdk-nested-tree-node')) { |
| 1505 | return numberAttribute(parent.getAttribute('aria-level')!); |
| 1506 | } else { |
| 1507 | // The ancestor element is the cdk-tree itself |
| 1508 | return 0; |
| 1509 | } |
| 1510 | } |
| 1511 | |
| 1512 | function isNodeElement(element: HTMLElement) { |
| 1513 | const classList = element.classList; |
no test coverage detected
searching dependent graphs…