diff options
author | bors-servo <metajack+bors@gmail.com> | 2015-08-30 13:22:41 -0600 |
---|---|---|
committer | bors-servo <metajack+bors@gmail.com> | 2015-08-30 13:22:41 -0600 |
commit | 86da67bb1e229f16b13892c42bd2a444b1b97644 (patch) | |
tree | 0108ba015b6364b317087eb0f2268279f15ef261 /components/script/dom | |
parent | 347e9b6ef45fb8b0e5a824944e4b1c7338d15554 (diff) | |
parent | faa581be86e0a47c443c100a1e851ca442fb01bd (diff) | |
download | servo-86da67bb1e229f16b13892c42bd2a444b1b97644.tar.gz servo-86da67bb1e229f16b13892c42bd2a444b1b97644.zip |
Auto merge of #7407 - nox:childnodes-replace, r=jdm
Optimise most basic case of .replaceChild() when updating childNodes
<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/7407)
<!-- Reviewable:end -->
Diffstat (limited to 'components/script/dom')
-rw-r--r-- | components/script/dom/nodelist.rs | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/components/script/dom/nodelist.rs b/components/script/dom/nodelist.rs index 01bc27d3a08..3e2bc5145c6 100644 --- a/components/script/dom/nodelist.rs +++ b/components/script/dom/nodelist.rs @@ -215,7 +215,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)) => { |