This project has moved and is read-only. For the latest updates, please go here.
2
Vote

OwnerDocument property is inconsistent

description

When i tried to add an onChange event to the HtmlDocument class I found that if you fill a node with the innerHtml.set() function, it creates a new document and then appends all children to the target node.

HtmlDocument doc = new HtmlDocument();
doc.LoadHtml(value);

RemoveAllChildren();
AppendChildren(doc.DocumentNode.ChildNodes);

But within AppendChild(HtmlNode NewNode) the NewNode.OwnerDocument doesn't change, so if you use innerHtml.set() a lot of your memory will be filled with unused HtmlDocuments because they are still referenced by the OwnerDocument property of the appended children. This may be a small issue but for me it’s irritating when the OwnerDocument property differs inside a Document

comments