diff --git a/engine/engine.go b/engine/engine.go index a9344b814afcb74269d813637fd89426c930ff93..7900c9578eb7b0b4516d447c22f395b733cb0e04 100644 --- a/engine/engine.go +++ b/engine/engine.go @@ -242,17 +242,12 @@ func runNode(node *html.Node, data *map[any]any, key string, item interface{}, n } -func cloneNode(n *html.Node, cache map[*html.Node]*html.Node) *html.Node { +func CloneNode(n *html.Node) *html.Node { if n == nil { return nil } - if val, ok := cache[n]; ok { - return val - } - val := &html.Node{} - cache[n] = val val.Type = n.Type val.Data = n.Data @@ -262,7 +257,7 @@ func cloneNode(n *html.Node, cache map[*html.Node]*html.Node) *html.Node { copy(val.Attr, n.Attr) for child := n.FirstChild; child != nil; child = child.NextSibling { - val.AppendChild(cloneNode(child, cache)) + val.AppendChild(CloneNode(child)) } return val