Add document.createElement and document.createTextNode.

This re-uses the parser's node creation code. That could probably be put
somewhere nicer. Suggestions welcome!
This commit is contained in:
Jack Moffitt 2013-09-10 16:08:02 -06:00
parent 2d556303ca
commit 227bb95213
4 changed files with 34 additions and 6 deletions

View file

@ -209,7 +209,7 @@ fn js_script_listener(to_parent: SharedChan<HtmlDiscoveryMessage>,
// Silly macros to handle constructing DOM nodes. This produces bad code and should be optimized
// via atomization (issue #85).
fn build_element_from_tag(cx: *JSContext, tag: &str) -> AbstractNode<ScriptView> {
pub fn build_element_from_tag(cx: *JSContext, tag: &str) -> AbstractNode<ScriptView> {
// TODO (Issue #85): use atoms
handle_element!(cx, tag, "a", HTMLAnchorElementTypeId, HTMLAnchorElement, []);
handle_element!(cx, tag, "applet", HTMLAppletElementTypeId, HTMLAppletElement, []);