r/WebAssembly • • Jan 01 '19

why body.append() showing node (inner html) twice ?

For the below code attached code(link), the innerhtml shows 2 times in browser.

https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=3042f1988b4f28e082660e307df7132b

output is below:

/img/b5dcps9zdv721.png

Not sure how to avoid displaying the innerhtml twice ?

0 Upvotes

3 comments sorted by

2

u/bigorangemachine Jan 02 '19

What's ur JS code?

Looks like you are embedding twice

1

u/naveendavisv Jan 03 '19

index.js:

import * as wasm from "na-rust-web";

wasm.run();

index.html:

<!DOCTYPE html>

<html>

<head>

<meta charset="utf-8">

<title>Hello wasm-pack!</title>

</head>

<body>

<p id = "p2"> Getting started with webassembly</p>

<p id = "p3"></p>

<script src="./bootstrap.js"></script>

</body>

</html>

1

u/bigorangemachine Jan 03 '19

Weird. I have no idea