aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/nodelist.rs
diff options
context:
space:
mode:
authorAnthony Ramine <n.oxyde@gmail.com>2015-08-27 13:39:47 +0200
committerAnthony Ramine <n.oxyde@gmail.com>2015-08-27 13:47:25 +0200
commitfaa581be86e0a47c443c100a1e851ca442fb01bd (patch)
tree36e99423c1b458c3219515a23ad1d3325c848377 /components/script/dom/nodelist.rs
parent532fd19d69fd11d06bca7539c722a46fab2c4419 (diff)
downloadservo-faa581be86e0a47c443c100a1e851ca442fb01bd.tar.gz
servo-faa581be86e0a47c443c100a1e851ca442fb01bd.zip
Optimise most basic case of .replaceChild() when updating childNodes
Diffstat (limited to 'components/script/dom/nodelist.rs')
-rw-r--r--components/script/dom/nodelist.rs5
1 files changed, 4 insertions, 1 deletions
diff --git a/components/script/dom/nodelist.rs b/components/script/dom/nodelist.rs
index eb3353a4d6e..514221f850d 100644
--- a/components/script/dom/nodelist.rs
+++ b/components/script/dom/nodelist.rs
@@ -218,7 +218,10 @@ impl ChildrenList {
},
};
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) {
(Some(_), None) => {},
(None, Some(next)) => {