Skip to content
Snippets Groups Projects
Verified Commit 5600c73a authored by Volker Schukai's avatar Volker Schukai :alien:
Browse files

feat: Cache is obsolete

parent 452e27d2
No related branches found
No related tags found
No related merge requests found
...@@ -242,17 +242,12 @@ func runNode(node *html.Node, data *map[any]any, key string, item interface{}, n ...@@ -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 { if n == nil {
return nil return nil
} }
if val, ok := cache[n]; ok {
return val
}
val := &html.Node{} val := &html.Node{}
cache[n] = val
val.Type = n.Type val.Type = n.Type
val.Data = n.Data val.Data = n.Data
...@@ -262,7 +257,7 @@ func cloneNode(n *html.Node, cache map[*html.Node]*html.Node) *html.Node { ...@@ -262,7 +257,7 @@ func cloneNode(n *html.Node, cache map[*html.Node]*html.Node) *html.Node {
copy(val.Attr, n.Attr) copy(val.Attr, n.Attr)
for child := n.FirstChild; child != nil; child = child.NextSibling { for child := n.FirstChild; child != nil; child = child.NextSibling {
val.AppendChild(cloneNode(child, cache)) val.AppendChild(CloneNode(child))
} }
return val return val
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment