mirror of
https://github.com/servo/servo.git
synced 2025-07-28 09:40:33 +01:00
Remove the IElement trait.
This commit is contained in:
parent
6388dec996
commit
a3d13c35a2
1 changed files with 14 additions and 29 deletions
|
@ -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());
|
||||
}
|
||||
_ => ()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue