Optimize Node.normalize().

Do not copy the discarded node's text data, borrow it.

Closes #6658.
This commit is contained in:
Michael Howell 2015-07-19 17:44:48 -07:00
parent 36d732a60a
commit 402a2a8717
2 changed files with 7 additions and 3 deletions

View file

@ -2330,10 +2330,9 @@ impl<'a> NodeMethods for &'a Node {
} else {
match prev_text {
Some(ref text_node) => {
let text_node = text_node.clone();
let prev_characterdata =
CharacterDataCast::from_ref(text_node.r());
let _ = prev_characterdata.AppendData(characterdata.Data());
prev_characterdata.append_data(&**characterdata.data());
self.remove_child(child.r());
},
None => prev_text = Some(Root::from_ref(text))