Webkit was the first to include/expose the following method for that task:
document.implementation.createHTMLDocument(title);
Firefox, from version 4, also implements this method while for previous versions it is possible to create an HTML document using the following:
var doc = document.implementation.createDocument('', '',
document.implementation.createDocumentType('html', '', ''));
which should be roughly equivalent to a document having <!DOCTYPE html>
(HTML5).
Replace the empty strings of 'createDocumentType' with the needed publicId/systemId.
It will be still necessary to create/append html, head and body elements to the resulting document to have a working DOM.