Deep copy a node. The new node has clones of all the original node's children but none of its parents or siblings.
(n *html.Node)
| 604 | // Deep copy a node. The new node has clones of all the original node's |
| 605 | // children but none of its parents or siblings. |
| 606 | func cloneNode(n *html.Node) *html.Node { |
| 607 | nn := &html.Node{ |
| 608 | Type: n.Type, |
| 609 | DataAtom: n.DataAtom, |
| 610 | Data: n.Data, |
| 611 | Attr: make([]html.Attribute, len(n.Attr)), |
| 612 | } |
| 613 | |
| 614 | copy(nn.Attr, n.Attr) |
| 615 | for c := n.FirstChild; c != nil; c = c.NextSibling { |
| 616 | nn.AppendChild(cloneNode(c)) |
| 617 | } |
| 618 | |
| 619 | return nn |
| 620 | } |
| 621 | |
| 622 | func (s *Selection) manipulateNodes(ns []*html.Node, reverse bool, |
| 623 | f func(sn *html.Node, n *html.Node)) *Selection { |
no outgoing calls
no test coverage detected
searching dependent graphs…