From 5600c73aa3158b1b1246976653038c05ef8cf52a Mon Sep 17 00:00:00 2001 From: Volker Schukai <volker.schukai@schukai.com> Date: Fri, 23 Dec 2022 10:12:09 +0100 Subject: [PATCH] feat: Cache is obsolete --- engine/engine.go | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/engine/engine.go b/engine/engine.go index a9344b8..7900c95 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 -- GitLab