Implement ChildNode.remove()

This commit is contained in:
Harry Maclean 2014-04-22 17:41:29 +01:00 committed by Josh Matthews
parent 325a39b8ba
commit 6f310a5c20
8 changed files with 61 additions and 7 deletions

View file

@ -406,6 +406,7 @@ pub trait ElementMethods {
fn GetInnerHTML(&self) -> Fallible<DOMString>;
fn GetOuterHTML(&self) -> Fallible<DOMString>;
fn Children(&self) -> Temporary<HTMLCollection>;
fn Remove(&mut self);
}
impl<'a> ElementMethods for JSRef<'a, Element> {
@ -678,6 +679,12 @@ impl<'a> ElementMethods for JSRef<'a, Element> {
let window = window_from_node(self).root();
HTMLCollection::children(&*window, NodeCast::from_ref(self))
}
// http://dom.spec.whatwg.org/#dom-childnode-remove
fn Remove(&mut self) {
let node: &mut JSRef<Node> = NodeCast::from_mut_ref(self);
node.remove_self();
}
}
pub fn get_attribute_parts(name: DOMString) -> (Option<~str>, ~str) {