Refactor fragment parsing

This commit is contained in:
Anthony Ramine 2016-11-30 01:23:58 +01:00
parent ea4fbbc63a
commit 03e04179ae
4 changed files with 67 additions and 46 deletions

View file

@ -51,7 +51,6 @@ use dom::htmltextareaelement::{HTMLTextAreaElement, LayoutHTMLTextAreaElementHel
use dom::nodelist::NodeList;
use dom::processinginstruction::ProcessingInstruction;
use dom::range::WeakRangeVec;
use dom::servoparser::ServoParser;
use dom::svgsvgelement::{SVGSVGElement, LayoutSVGSVGElementHelpers};
use dom::text::Text;
use dom::virtualmethods::{VirtualMethods, vtable_for};
@ -799,19 +798,6 @@ impl Node {
}
}
// https://dvcs.w3.org/hg/innerhtml/raw-file/tip/index.html#dfn-concept-parse-fragment
pub fn parse_fragment(&self, markup: DOMString) -> Fallible<Root<DocumentFragment>> {
let context_document = document_from_node(self);
let fragment = DocumentFragment::new(&context_document);
if context_document.is_html_document() {
ServoParser::parse_html_fragment(self.upcast(), markup, fragment.upcast());
} else {
// FIXME: XML case
unimplemented!();
}
Ok(fragment)
}
/// Used by `HTMLTableSectionElement::InsertRow` and `HTMLTableRowElement::InsertCell`
pub fn insert_cell_or_row<F, G, I>(&self, index: i32, get_items: F, new_child: G) -> Fallible<Root<HTMLElement>>
where F: Fn() -> Root<HTMLCollection>,