nextSibling returns the next node with the same parent.
()
| 91 | |
| 92 | // nextSibling returns the next node with the same parent. |
| 93 | func (n *node) nextSibling() *node { |
| 94 | if n.parent == nil { |
| 95 | return nil |
| 96 | } |
| 97 | index := n.parent.childIndex(n) |
| 98 | if index >= n.parent.numChildren()-1 { |
| 99 | return nil |
| 100 | } |
| 101 | return n.parent.childAt(index + 1) |
| 102 | } |
| 103 | |
| 104 | // prevSibling returns the previous node with the same parent. |
| 105 | func (n *node) prevSibling() *node { |
no test coverage detected