Description
The code in question is introduced in PR #276.
A new enum MountType
was introduced for dealing with how to handle elements that are already attached to the root element (the mount_point
). The behavior of MountType::Append
is approximately the same as before the change. The behavior of MountType::Takeover
is that it will add preexisting nodes to the tree, delete the underlying DOM nodes, then construct new DOM nodes.
The second is a little problematic. It is problematic because there can be nodes that should not be recreated (like script
nodes). It also replaces unknown elements with the span
element, which may also be problematic if someone has custom tags.
Additionally, the tag checking mechanism is slightly buggy, as the many tags have an upper case letter in their spellings, causing scripts to be removed from the DOM. The tag names are listing in dom_types.rs
.
Lastly, this is also a bit inefficient, but it is a one time cost.
These issues might need to be addressed later.