* Locates the next tNode (child, sibling or parent).
(tNode: TNode)
| 229 | * Locates the next tNode (child, sibling or parent). |
| 230 | */ |
| 231 | function traverseNextElement(tNode: TNode): TNode | null { |
| 232 | if (tNode.child) { |
| 233 | return tNode.child; |
| 234 | } else if (tNode.next) { |
| 235 | return tNode.next; |
| 236 | } else { |
| 237 | // Let's take the following template: <div><span>text</span></div><component/> |
| 238 | // After checking the text node, we need to find the next parent that has a "next" TNode, |
| 239 | // in this case the parent `div`, so that we can find the component. |
| 240 | while (tNode.parent && !tNode.parent.next) { |
| 241 | tNode = tNode.parent; |
| 242 | } |
| 243 | return tNode.parent && tNode.parent.next; |
| 244 | } |
| 245 | } |
| 246 | |
| 247 | /** |
| 248 | * Locates the component within the given LView and returns the matching index |