Merge pull request #230 from t1m0t/master

fix some uncaught error during runtime test
This commit is contained in:
Jonathan Kelley authored and GitHub committed 2022-02-11 12:12:44 -05:00
commit e3d4c1cde4
1 file changed
+9 -1
+9 -1
View File
@@ -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 { Self {
interpreter: Interpreter::new(root.clone()), interpreter: Interpreter::new(root.clone()),