Skip to content

Commit

Permalink
fix some uncaught error during runtime test
Browse files Browse the repository at this point in the history
  • Loading branch information
t1m0t committed Feb 11, 2022
1 parent f9a5016 commit eb39f36
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion packages/web/src/dom.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,15 @@ impl WebsysDom {
}
});

let root = load_document().get_element_by_id(&cfg.rootname).unwrap();
let document = load_document();
let root = match document.get_element_by_id(&cfg.rootname) {
Some(root) => root,
// a match here in order to avoid some error during runtime browser test
None => {
let body = document.create_element("body").ok().unwrap();
body
}
};

Self {
interpreter: Interpreter::new(root.clone()),
Expand Down

0 comments on commit eb39f36

Please sign in to comment.