parentNode := child.node.Get("parentNode") //Added this because if the child has had the parentNode removed this will crash
if parentNode == nil {
log.Println("vecty: parentNode is nil") //The error could be logged??
//panic("vecty: DOM parent node is nil") // or it could trigger a panic??
return // or just return??
}
parentNode.Call("removeChild", child.node)
This is a similar response to the child.node being nil.
if
removeChild
is called with a child node that has no parent in the DOM it will crash.https://github.com/hexops/vecty/blob/2abc3fbe89ef72f3767236869a48635516765135/dom.go#L641-L656
The following Line https://github.com/hexops/vecty/blob/2abc3fbe89ef72f3767236869a48635516765135/dom.go#L655 could be replaced with something like the following...
This is a similar response to the
child.node
being nil.