add error log when root element isn't found (#1724)
This commit is contained in:
1 parent
1ec230ae29
commit
2321c1ad44
2 files changed
+11
-1
No files matched your search
@@ -42,6 +42,7 @@ features = [
|
|||||||
"HtmlFormElement",
|
"HtmlFormElement",
|
||||||
"Text",
|
"Text",
|
||||||
"Window",
|
"Window",
|
||||||
|
"console",
|
||||||
]
|
]
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
|
|||||||
+10
-1
@@ -45,7 +45,16 @@ impl WebsysDom {
|
|||||||
let document = load_document();
|
let document = load_document();
|
||||||
let root = match document.get_element_by_id(&cfg.rootname) {
|
let root = match document.get_element_by_id(&cfg.rootname) {
|
||||||
Some(root) => root,
|
Some(root) => root,
|
||||||
None => document.create_element("body").ok().unwrap(),
|
None => {
|
||||||
|
web_sys::console::error_1(
|
||||||
|
&format!(
|
||||||
|
"element '#{}' not found. mounting to the body.",
|
||||||
|
cfg.rootname
|
||||||
|
)
|
||||||
|
.into(),
|
||||||
|
);
|
||||||
|
document.create_element("body").ok().unwrap()
|
||||||
|
}
|
||||||
};
|
};
|
||||||
let interpreter = Channel::default();
|
let interpreter = Channel::default();
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user