|
@@ -26,14 +26,16 @@ func (node *Node) SetOuterHTML(str string) {
|
|
|
closeTag.token = ""
|
|
|
|
|
|
//use the token to insert str
|
|
|
- node.token = str
|
|
|
+ node.token = ""
|
|
|
node.Children = []*Node{}
|
|
|
|
|
|
// regen parent
|
|
|
- tokList := getTokenList(node.Parent.InnerHTML())
|
|
|
+ tokList := getTokenList(str)
|
|
|
tree := buildTree(tokList)
|
|
|
-
|
|
|
- node.Parent.Children = tree.Children
|
|
|
+ node.Children = tree.Children
|
|
|
+ for _, child := range tree.Children {
|
|
|
+ child.Parent = node
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
func (node *Node) InnerHTML() string {
|