Add overridable tree binding/unbinding behaviour.

This commit is contained in:
Josh Matthews 2014-02-13 08:50:28 +05:30 committed by Ms2ger
parent f5d1907195
commit 6388dec996
3 changed files with 39 additions and 10 deletions

View file

@ -42,6 +42,22 @@ pub trait VirtualMethods {
_ => (),
}
}
/// Called when a Node is appended to a tree that is part of a Document.
fn bind_to_tree(&mut self) {
match self.super_type() {
Some(ref mut s) => s.bind_to_tree(),
_ => (),
}
}
/// Called when a Node is removed from a tree that is part of a Document.
fn unbind_from_tree(&mut self) {
match self.super_type() {
Some(ref mut s) => s.unbind_from_tree(),
_ => (),
}
}
}
/// Obtain a VirtualMethods instance for a given Node-derived object. Any