Auto merge of #9526 - schuster:node-remove, r=nox

My updates so far for issue #8465. See comments there for more information.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.svg" height="40" alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/9526)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2016-02-19 03:14:28 +05:30
commit 2374e9d30e
2 changed files with 8 additions and 3 deletions

View file

@ -1551,12 +1551,15 @@ impl Node {
Some(index)
}
};
// Step 6.
// Step 6. pre-removing steps for node iterators
// Step 7.
let old_previous_sibling = node.GetPreviousSibling();
// Steps 7-8: mutation observers.
// Step 9.
// Step 8.
let old_next_sibling = node.GetNextSibling();
// Steps 9-10 are handled in unbind_from_tree.
parent.remove_child(node, cached_index);
// Step 11. transient registered observers
// Step 12.
if let SuppressObserver::Unsuppressed = suppress_observers {
vtable_for(&parent).children_changed(
&ChildrenMutation::replace(old_previous_sibling.r(),

View file

@ -83,6 +83,8 @@ pub trait VirtualMethods {
/// Called when a Node is removed from a tree, where 'tree_in_doc'
/// indicates whether the tree is part of a Document.
/// Implements removing steps:
/// https://dom.spec.whatwg.org/#concept-node-remove-ext
fn unbind_from_tree(&self, context: &UnbindContext) {
if let Some(ref s) = self.super_type() {
s.unbind_from_tree(context);