diff --git a/modules/platform-node/node-document.ts b/modules/platform-node/node-document.ts index 6f3329bd1..6b6866b2c 100644 --- a/modules/platform-node/node-document.ts +++ b/modules/platform-node/node-document.ts @@ -26,17 +26,16 @@ export function parseDocument (documentHtml: string): any { throw new Error('parseDocument needs to be a string to be parsed correctly'); } - const doc = parse5.parse(documentHtml, { treeAdapter : parse5.treeAdapters.htmlparser2 }); + let doc; - - /* // Build entire doc <!doctype><html> etc if (documentHtml.indexOf('<html>') > -1 && documentHtml.indexOf('</html>') > -1) { - const doc = parser.parse(documentHtml); + doc = parse5.parse(documentHtml, { treeAdapter : parse5.treeAdapters.htmlparser2 }); + } else { + // ASP.NET case : parse only the fragment - don't build entire <html> doc + doc = parseFragment(documentHtml); } - // ASP.NET case : parse only the fragment - don't build entire <html> doc - const doc = parser.parseFragment(documentHtml); - */ + let rootNode = undefined; let bodyNode = undefined;