lightspark/lightspark — pull request #231 by briefbanane (2013-09-17 21:34:20+00:00)
Title: Fix appendChild when children with parents receive a child themselves

This fixes the "Appending XML nodes"-test in tests/XML_test.mxml by supporting to add nodes to non-root nodes.

libxml2 merges adjacent text nodes and doesn't preserve the tree structure of the nodes. Because of this we need to manage the tree on our own. libxml++ doesn't help either, because it supports only importing nodes, i.e. building the tree by copying the whole child. Their copies don't know automatically when one of "our" nodes updates.
Now "our" nodes must inform their respective parents, when they get updated structurally (when a child is added to them). Each node saves the pointer to their coupled node in the libxml2 tree structure and informs their parent to remove the old child and add themselves as a new updated copy. This updates the whole tree from bottom up as needed.
As this updates the underlying structure of the libxml2 implementation, other methods using libxml++ and libxml2 will see the updated versions as well.

A thing I wanted to ask is if I should continue sending patches using pull requests on github or if there is another preferred way to do so?