Skip to content

Commit

Permalink
Merge pull request #1765 from traxys/fixup_wasm_replace
Browse files Browse the repository at this point in the history
winit: Fix replacement of node in wasm
  • Loading branch information
hecrj committed Mar 23, 2023
2 parents d7fffaa + 0231ed6 commit be36c3f
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions winit/src/application.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,13 +179,17 @@ where
.unwrap_or(None)
});

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

Expand Down

0 comments on commit be36c3f

Please sign in to comment.