diff options
author | bors-servo <release+servo@mozilla.com> | 2013-11-05 09:34:25 -0800 |
---|---|---|
committer | bors-servo <release+servo@mozilla.com> | 2013-11-05 09:34:25 -0800 |
commit | d00736a9c059f08c8b411b3aada795e8bb9e2ea3 (patch) | |
tree | dbb2f460a9de5d1b0bd2ef01c18fd5a5b69a007f /src/components/script/dom/documentfragment.rs | |
parent | 978f16f1926850d433d9b1c175314edbe30248cd (diff) | |
parent | ad658ba4ecc35187e194124c1b1acffea3d214bc (diff) | |
download | servo-d00736a9c059f08c8b411b3aada795e8bb9e2ea3.tar.gz servo-d00736a9c059f08c8b411b3aada795e8bb9e2ea3.zip |
auto merge of #1189 : Ms2ger/servo/new-node, r=jdm
Diffstat (limited to 'src/components/script/dom/documentfragment.rs')
-rw-r--r-- | src/components/script/dom/documentfragment.rs | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/components/script/dom/documentfragment.rs b/src/components/script/dom/documentfragment.rs index 78f3d5c84cb..d3c2beaceff 100644 --- a/src/components/script/dom/documentfragment.rs +++ b/src/components/script/dom/documentfragment.rs @@ -2,6 +2,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +use dom::bindings::codegen::DocumentFragmentBinding; use dom::bindings::utils::Fallible; use dom::document::AbstractDocument; use dom::node::{ScriptView, Node, DocumentFragmentNodeTypeId}; @@ -14,15 +15,20 @@ pub struct DocumentFragment { impl DocumentFragment { /// Creates a new DocumentFragment. - pub fn new(document: AbstractDocument) -> DocumentFragment { + pub fn new_inherited(document: AbstractDocument) -> DocumentFragment { DocumentFragment { node: Node::new(DocumentFragmentNodeTypeId, document), } } + pub fn new(document: AbstractDocument) -> AbstractNode<ScriptView> { + let node = DocumentFragment::new_inherited(document); + Node::reflect_node(@mut node, document, DocumentFragmentBinding::Wrap) + } +} + +impl DocumentFragment { pub fn Constructor(owner: @mut Window) -> Fallible<AbstractNode<ScriptView>> { - let cx = owner.get_cx(); - let fragment = @DocumentFragment::new(owner.Document()); - Ok(unsafe { Node::as_abstract_node(cx, fragment) }) + Ok(DocumentFragment::new(owner.Document())) } } |