Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move Parser creation to its own function. #2898

Closed
wants to merge 2 commits into from
Closed
Changes from 1 commit
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

Prev

Move Parser creation to its own function (issue #849).

This is the first step to implement innerHTML, as we need a way
create and initialize a parser object while setting the received
DOMString (which may be either text/html/whatever).
  • Loading branch information
Adenilson committed Jul 22, 2014
commit 72404f9488a87eaef76e0e3d2cff9eb21333c932
@@ -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);
return parser
}

ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.