Don't call bind_to_tree when appending a node to another node that isn't in the tree (fixes #1874).

This commit is contained in:
Tetsuharu OHZEKI 2014-03-15 17:31:11 +09:00
parent bfb849bb04
commit 6ecb9ba4b6
2 changed files with 21 additions and 8 deletions

View file

@ -405,10 +405,12 @@ impl NodeHelpers for JS<Node> {
assert!(self.parent_node().is_some());
let document = document_from_node(self);
for node in self.traverse_preorder() {
if node.is_element() {
let element: JS<Element> = ElementCast::to(&node);
element.bind_to_tree_impl();
if self.is_in_doc() {
for node in self.traverse_preorder() {
if node.is_element() {
let element: JS<Element> = ElementCast::to(&node);
element.bind_to_tree_impl();
}
}
}