I wrote this script to see how new nodes can be created with createElement():
<!DOCTYPE HTML>
<html>
<head>
<title>DOM Traversal</title>
</head>
<body>
<div>
<p>Sample paragraph</p>
</div>
<h1>Sample H1</h1>
<script>
var p = document.getElementsByTagName("p")[0];
var n = document.createElement("strong");
n.innerHTML = "--LOL--";
p.appendChild(n);
console.log("Done!");
</script>
</body>
</html>
After I load the page, I can see the new node rendered, but it's not there in View Source (in Chrome). Why is this happening?