Permalink
Browse files

Merge pull request #2901 from Adenilson/innerHTML-step01b

Move Parser creation to its own function (issue #849).
  • Loading branch information...
Manishearth committed Jul 22, 2014
2 parents 9f06b3c + 67f43e2 commit ae5093ed4fafcce7b515454a0e53f9ccd40d5735
Showing with 9 additions and 5 deletions.
  1. +9 −5 src/components/script/html/hubbub_html_parser.rs
@@ -328,13 +328,9 @@ pub fn parse_html(page: &Page,
*page.mut_url() = Some((base_url.clone(), true));
}
- let mut parser = hubbub::Parser("UTF-8", false);
+ let mut parser = build_parser(unsafe { document.to_hubbub_node() });
debug!("created parser");
- parser.set_document_node(unsafe { document.to_hubbub_node() });
- parser.enable_scripting(true);
- parser.enable_styling(true);
-
let (css_chan2, js_chan2) = (css_chan.clone(), js_chan.clone());
let doc_cell = RefCell::new(document);
@@ -557,3 +553,11 @@ pub fn parse_html(page: &Page,
}
}
+fn build_parser(node: hubbub::NodeDataPtr) -> hubbub::Parser {
+ let mut parser = hubbub::Parser("UTF-8", false);
+ parser.set_document_node(node);
+ parser.enable_scripting(true);
+ parser.enable_styling(true);
+ parser
+}
+

0 comments on commit ae5093e

Please sign in to comment.