mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
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:
commit
2374e9d30e
2 changed files with 8 additions and 3 deletions
|
@ -1551,12 +1551,15 @@ impl Node {
|
||||||
Some(index)
|
Some(index)
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
// Step 6.
|
// Step 6. pre-removing steps for node iterators
|
||||||
|
// Step 7.
|
||||||
let old_previous_sibling = node.GetPreviousSibling();
|
let old_previous_sibling = node.GetPreviousSibling();
|
||||||
// Steps 7-8: mutation observers.
|
// Step 8.
|
||||||
// Step 9.
|
|
||||||
let old_next_sibling = node.GetNextSibling();
|
let old_next_sibling = node.GetNextSibling();
|
||||||
|
// Steps 9-10 are handled in unbind_from_tree.
|
||||||
parent.remove_child(node, cached_index);
|
parent.remove_child(node, cached_index);
|
||||||
|
// Step 11. transient registered observers
|
||||||
|
// Step 12.
|
||||||
if let SuppressObserver::Unsuppressed = suppress_observers {
|
if let SuppressObserver::Unsuppressed = suppress_observers {
|
||||||
vtable_for(&parent).children_changed(
|
vtable_for(&parent).children_changed(
|
||||||
&ChildrenMutation::replace(old_previous_sibling.r(),
|
&ChildrenMutation::replace(old_previous_sibling.r(),
|
||||||
|
|
|
@ -83,6 +83,8 @@ pub trait VirtualMethods {
|
||||||
|
|
||||||
/// Called when a Node is removed from a tree, where 'tree_in_doc'
|
/// Called when a Node is removed from a tree, where 'tree_in_doc'
|
||||||
/// indicates whether the tree is part of a Document.
|
/// 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) {
|
fn unbind_from_tree(&self, context: &UnbindContext) {
|
||||||
if let Some(ref s) = self.super_type() {
|
if let Some(ref s) = self.super_type() {
|
||||||
s.unbind_from_tree(context);
|
s.unbind_from_tree(context);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue