Optimise most basic case of .replaceChild() when updating childNodes

This commit is contained in:
Anthony Ramine 2015-08-27 13:39:47 +02:00
parent 532fd19d69
commit faa581be86

View file

@ -218,7 +218,10 @@ impl ChildrenList {
}, },
}; };
list.last_visited.set(Some(JS::from_ref(visited))); list.last_visited.set(Some(JS::from_ref(visited)));
} else { } else if added.len() != 1 {
// The replaced child isn't the last visited one, and there are
// 0 or more than 1 nodes to replace it. Special care must be
// given to update the state of that ChildrenList.
match (prev, next) { match (prev, next) {
(Some(_), None) => {}, (Some(_), None) => {},
(None, Some(next)) => { (None, Some(next)) => {