aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/script/dom/element.rs
diff options
context:
space:
mode:
authorMs2ger <ms2ger@gmail.com>2014-04-10 09:56:46 +0200
committerMs2ger <ms2ger@gmail.com>2014-04-10 10:27:32 +0200
commita3d13c35a2a46fa7a30e705182980fe06aa04e3c (patch)
tree3e72d041e377e2effc5e53326aeb54440faf0da0 /src/components/script/dom/element.rs
parent6388dec9966679202904f2f59d8efe8df7edb9c8 (diff)
downloadservo-a3d13c35a2a46fa7a30e705182980fe06aa04e3c.tar.gz
servo-a3d13c35a2a46fa7a30e705182980fe06aa04e3c.zip
Remove the IElement trait.
Diffstat (limited to 'src/components/script/dom/element.rs')
-rw-r--r--src/components/script/dom/element.rs43
1 files changed, 14 insertions, 29 deletions
diff --git a/src/components/script/dom/element.rs b/src/components/script/dom/element.rs
index d1b19f41ebe..b06e3253989 100644
--- a/src/components/script/dom/element.rs
+++ b/src/components/script/dom/element.rs
@@ -632,33 +632,6 @@ impl Element {
}
}
-pub trait IElement {
- fn bind_to_tree_impl(&self);
- fn unbind_from_tree_impl(&self);
-}
-
-impl IElement for JS<Element> {
- fn bind_to_tree_impl(&self) {
- match self.get_attribute(Null, "id") {
- Some(attr) => {
- let mut doc = document_from_node(self);
- doc.get_mut().register_named_element(self, attr.get().Value());
- }
- _ => ()
- }
- }
-
- fn unbind_from_tree_impl(&self) {
- match self.get_attribute(Null, "id") {
- Some(attr) => {
- let mut doc = document_from_node(self);
- doc.get_mut().unregister_named_element(self, attr.get().Value());
- }
- _ => ()
- }
- }
-}
-
pub fn get_attribute_parts(name: DOMString) -> (Option<~str>, ~str) {
//FIXME: Throw for XML-invalid names
//FIXME: Throw for XMLNS-invalid names
@@ -734,7 +707,13 @@ impl VirtualMethods for JS<Element> {
_ => (),
}
- self.bind_to_tree_impl();
+ match self.get_attribute(Null, "id") {
+ Some(attr) => {
+ let mut doc = document_from_node(self);
+ doc.get_mut().register_named_element(self, attr.get().Value());
+ }
+ _ => ()
+ }
}
fn unbind_from_tree(&mut self) {
@@ -743,6 +722,12 @@ impl VirtualMethods for JS<Element> {
_ => (),
}
- self.unbind_from_tree_impl();
+ match self.get_attribute(Null, "id") {
+ Some(attr) => {
+ let mut doc = document_from_node(self);
+ doc.get_mut().unregister_named_element(self, attr.get().Value());
+ }
+ _ => ()
+ }
}
}