<!DOCTYPE html>
<html lang="en-US">
<body>
<p>This Example uses 'document.implementation.createDocument' to create a new document.</p>
<p>Check your console (Press F12).</p>
<script>
function createDocument(html) {
var doc = document.implementation.createDocument ('http://www.w3.org/1999/xhtml', 'html', null);
doc.documentElement.innerHTML = html;
console.log(doc);
}
createDocument("<body><p>Hello World</p></body>");
</script> </body>
</html>