diff options
author | Anthony Ramine <n.oxyde@gmail.com> | 2015-04-16 10:28:09 +0200 |
---|---|---|
committer | Anthony Ramine <n.oxyde@gmail.com> | 2015-04-16 20:31:34 +0200 |
commit | 45e1b9628ee6a9adff54a0d552278a004ecf0da6 (patch) | |
tree | 4432cc793f590a222c4a187b94bb97dcb2a28abe /components/script/dom/documentfragment.rs | |
parent | e2b43bd3a9136cb90b8e64097e6098db01fca47f (diff) | |
download | servo-45e1b9628ee6a9adff54a0d552278a004ecf0da6.tar.gz servo-45e1b9628ee6a9adff54a0d552278a004ecf0da6.zip |
Finish implementation of ChildNode and ParentNode
Diffstat (limited to 'components/script/dom/documentfragment.rs')
-rw-r--r-- | components/script/dom/documentfragment.rs | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/components/script/dom/documentfragment.rs b/components/script/dom/documentfragment.rs index 606a2066bca..0f38b512c7e 100644 --- a/components/script/dom/documentfragment.rs +++ b/components/script/dom/documentfragment.rs @@ -7,8 +7,9 @@ use dom::bindings::codegen::Bindings::DocumentFragmentBinding::DocumentFragmentM use dom::bindings::codegen::Bindings::WindowBinding::WindowMethods; use dom::bindings::codegen::InheritTypes::DocumentFragmentDerived; use dom::bindings::codegen::InheritTypes::{ElementCast, NodeCast}; +use dom::bindings::codegen::UnionTypes::NodeOrString; use dom::bindings::js::{JSRef, Temporary}; -use dom::bindings::error::Fallible; +use dom::bindings::error::{ErrorResult, Fallible}; use dom::bindings::global::GlobalRef; use dom::document::Document; use dom::element::Element; @@ -72,6 +73,16 @@ impl<'a> DocumentFragmentMethods for JSRef<'a, DocumentFragment> { NodeCast::from_ref(self).child_elements().count() as u32 } + // https://dom.spec.whatwg.org/#dom-parentnode-prepend + fn Prepend(self, nodes: Vec<NodeOrString>) -> ErrorResult { + NodeCast::from_ref(self).prepend(nodes) + } + + // https://dom.spec.whatwg.org/#dom-parentnode-append + fn Append(self, nodes: Vec<NodeOrString>) -> ErrorResult { + NodeCast::from_ref(self).append(nodes) + } + // https://dom.spec.whatwg.org/#dom-parentnode-queryselector fn QuerySelector(self, selectors: DOMString) -> Fallible<Option<Temporary<Element>>> { let root: JSRef<Node> = NodeCast::from_ref(self); |