Reorder changes in add_child to be correct.

This commit is contained in:
Ms2ger 2014-01-15 23:53:27 +01:00
parent fc76107a92
commit 0157ff3ca3

View file

@ -558,8 +558,6 @@ impl AbstractNode {
let before_node = before.mut_node(); let before_node = before.mut_node();
// XXX Should assert that parent is self. // XXX Should assert that parent is self.
assert!(before_node.parent_node.is_some()); assert!(before_node.parent_node.is_some());
before_node.set_prev_sibling(Some(new_child.clone()));
new_child_node.set_next_sibling(Some(before.clone()));
match before_node.prev_sibling { match before_node.prev_sibling {
None => { None => {
// XXX Should assert that before is the first child of // XXX Should assert that before is the first child of
@ -572,6 +570,8 @@ impl AbstractNode {
new_child_node.set_prev_sibling(Some(prev_sibling.clone())); new_child_node.set_prev_sibling(Some(prev_sibling.clone()));
}, },
} }
before_node.set_prev_sibling(Some(new_child.clone()));
new_child_node.set_next_sibling(Some(before.clone()));
}, },
None => { None => {
match this_node.last_child { match this_node.last_child {