aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/htmltitleelement.rs
diff options
context:
space:
mode:
authorAnthony Ramine <n.oxyde@gmail.com>2015-07-18 14:45:52 +0200
committerAnthony Ramine <n.oxyde@gmail.com>2015-07-25 19:09:40 +0200
commit7b40cc9fd7ea4dcc3816be0cb1ad6543bb5c88e0 (patch)
treee5667ee45868c9cbb34d8458cb88a85343467aae /components/script/dom/htmltitleelement.rs
parent389a9ff643b714c6c8ba01fd8f1d208773dccb7a (diff)
downloadservo-7b40cc9fd7ea4dcc3816be0cb1ad6543bb5c88e0.tar.gz
servo-7b40cc9fd7ea4dcc3816be0cb1ad6543bb5c88e0.zip
Introduce VirtualMethods::children_changed()
This virtual method mimics the behaviour of mutation observers and make it more viable than the older child_inserted(), which didn't cover removed nodes and was called as many times as there were inserted nodes. A few other shortcomings where remove_child() was called directly instead of Node::remove() were also fixed while at it.
Diffstat (limited to 'components/script/dom/htmltitleelement.rs')
-rw-r--r--components/script/dom/htmltitleelement.rs10
1 files changed, 4 insertions, 6 deletions
diff --git a/components/script/dom/htmltitleelement.rs b/components/script/dom/htmltitleelement.rs
index a6585bd17b4..e4f51b03629 100644
--- a/components/script/dom/htmltitleelement.rs
+++ b/components/script/dom/htmltitleelement.rs
@@ -13,7 +13,7 @@ use dom::document::{Document, DocumentHelpers};
use dom::eventtarget::{EventTarget, EventTargetTypeId};
use dom::element::ElementTypeId;
use dom::htmlelement::{HTMLElement, HTMLElementTypeId};
-use dom::node::{Node, NodeHelpers, NodeTypeId};
+use dom::node::{ChildrenMutation, Node, NodeHelpers, NodeTypeId};
use dom::text::Text;
use dom::virtualmethods::VirtualMethods;
use util::str::DOMString;
@@ -75,15 +75,13 @@ impl<'a> VirtualMethods for &'a HTMLTitleElement {
Some(htmlelement as &VirtualMethods)
}
- fn child_inserted(&self, child: &Node) {
+ fn children_changed(&self, mutation: &ChildrenMutation) {
if let Some(ref s) = self.super_type() {
- s.child_inserted(child);
+ s.children_changed(mutation);
}
-
let node = NodeCast::from_ref(*self);
if node.is_in_doc() {
- let document = node.owner_doc();
- document.r().title_changed();
+ node.owner_doc().title_changed();
}
}