Merge pull request #1765 from traxys/fixup_wasm_replace

winit: Fix replacement of node in wasm
This commit is contained in:
Héctor Ramón 2023-03-23 11:31:59 +01:00 committed by GitHub
commit be36c3f552
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -179,13 +179,17 @@ where
.unwrap_or(None) .unwrap_or(None)
}); });
let _ = match target { match target {
Some(node) => node Some(node) => {
.replace_child(&canvas, &node) let _ = node
.expect(&format!("Could not replace #{}", node.id())), .replace_with_with_node_1(&canvas)
None => body .expect(&format!("Could not replace #{}", node.id()));
.append_child(&canvas) }
.expect("Append canvas to HTML body"), None => {
let _ = body
.append_child(&canvas)
.expect("Append canvas to HTML body");
}
}; };
} }