mirror of
https://github.com/servo/servo.git
synced 2025-08-02 20:20:14 +01:00
Produce output of fragment parsing in &mut RootedVec<JS<Node>> argument
This commit is contained in:
parent
6422f38574
commit
f76a137344
2 changed files with 15 additions and 12 deletions
|
@ -936,16 +936,16 @@ impl<'a> NodeHelpers<'a> for JSRef<'a, Node> {
|
|||
fn parse_fragment(self, markup: DOMString) -> Fallible<Temporary<DocumentFragment>> {
|
||||
let context_node: JSRef<Node> = NodeCast::from_ref(self);
|
||||
let context_document = document_from_node(self).root();
|
||||
let new_children =
|
||||
if context_document.r().is_html_document() {
|
||||
parse_html_fragment(context_node, markup)
|
||||
} else {
|
||||
// FIXME: XML case
|
||||
unimplemented!()
|
||||
};
|
||||
let mut new_children: RootedVec<JS<Node>> = RootedVec::new();
|
||||
if context_document.r().is_html_document() {
|
||||
parse_html_fragment(context_node, markup, &mut new_children);
|
||||
} else {
|
||||
// FIXME: XML case
|
||||
unimplemented!();
|
||||
}
|
||||
let fragment = DocumentFragment::new(context_document.r()).root();
|
||||
let fragment_node: JSRef<Node> = NodeCast::from_ref(fragment.r());
|
||||
for node in new_children {
|
||||
for node in new_children.iter() {
|
||||
fragment_node.AppendChild(node.root().r()).unwrap();
|
||||
}
|
||||
Ok(Temporary::from_rooted(fragment.r()))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue