Skip to content

Commit

Permalink
add warning to Node.Parents
Browse files Browse the repository at this point in the history
  • Loading branch information
earthboundkid committed Jun 22, 2024
1 parent 13a4d2c commit e8797ff
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions html/iter.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ func (n *Node) All() iter.Seq[*Node] {
}

// Parents returns an sequence yielding the node and its parents.
//
// Mutating a Node while iterating through it or its parents may have unexpected results.
func (n *Node) Parents() iter.Seq[*Node] {
return func(yield func(*Node) bool) {
for p := n; p != nil; p = p.Parent {
Expand Down

0 comments on commit e8797ff

Please sign in to comment.