From e8797ff4782b852bcfe588ce03b5c9043a15c911 Mon Sep 17 00:00:00 2001 From: Carlana Johnson Date: Sat, 22 Jun 2024 15:29:35 -0400 Subject: [PATCH] add warning to Node.Parents --- html/iter.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/html/iter.go b/html/iter.go index f025f46b4c..c6ce86d38c 100644 --- a/html/iter.go +++ b/html/iter.go @@ -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 {