You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
which will panic if a node has a parent or siblings. Handling this is fairly straightforward, but there are some unexpected nuances that would be easily solved (and universally avoided) with a function like
func (n *Node) Detach()
In order to fix InsertBefore's panic, one could simply set "newChild.NextSibling", "newChild.PrevSibling", "newChild.Parent" to "nil". This would break the Linked Tree because its next and previous siblings, as well as its parent, would still point to that node. So everyone would essentially have to make their own "Detach" function anyways if they plan on moving nodes around in a tree.
So I'm proposing adding a Detach function. Your thoughts?
The text was updated successfully, but these errors were encountered:
Please answer these questions before submitting your issue. Thanks!
go version
)?1.6.3 linux/amd64
go env
)?Not sure questions 3, 4 and 5 are relevant.
I'd like to make a pull request but I'd also like some discussion beforehand so I don't waste anyone's time.
I think some added functionality to the
x/net/html
would be nice.For example, several of the functions on the Node type require that a node not be attached before it is used, like
func (n *Node) InsertBefore(newChild, oldChild *Node)
which will panic if a node has a parent or siblings. Handling this is fairly straightforward, but there are some unexpected nuances that would be easily solved (and universally avoided) with a function like
func (n *Node) Detach()
In order to fix InsertBefore's panic, one could simply set "newChild.NextSibling", "newChild.PrevSibling", "newChild.Parent" to "nil". This would break the Linked Tree because its next and previous siblings, as well as its parent, would still point to that node. So everyone would essentially have to make their own "Detach" function anyways if they plan on moving nodes around in a tree.
So I'm proposing adding a Detach function. Your thoughts?
The text was updated successfully, but these errors were encountered: