appendChild
returns the appended child, which in this case is the <canvas/>
-element of the WebGLRenderer
. You can’t append other elements to a canvas. Try this instead:
document.body.appendChild( renderer.domElement );
document.body.appendChild( stats.dom );