From 2f5ca6b02ed2f3cc4010effbd99b67370eb9c711 Mon Sep 17 00:00:00 2001
From: Mark Pieszak <mpieszak84@gmail.com>
Date: Mon, 31 Oct 2016 08:50:01 -0400
Subject: [PATCH 1/2] fix(node-document): create conditional for non html
 component

Fixes #347
---
 modules/platform-node/node-document.ts | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/modules/platform-node/node-document.ts b/modules/platform-node/node-document.ts
index 6f3329bd1..b0a9883c2 100644
--- a/modules/platform-node/node-document.ts
+++ b/modules/platform-node/node-document.ts
@@ -26,17 +26,15 @@ 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 });
   }
   // ASP.NET case : parse only the fragment - don't build entire <html> doc
-  const doc = parser.parseFragment(documentHtml);
-  */
+  doc = parseFragment(documentHtml);
+  
 
   let rootNode = undefined;
   let bodyNode = undefined;

From 0834bc411fe0c600baf4cabfa8587df0c108c380 Mon Sep 17 00:00:00 2001
From: Mark Pieszak <mpieszak84@gmail.com>
Date: Mon, 31 Oct 2016 08:52:30 -0400
Subject: [PATCH 2/2] fix(node-document): Add else for .NET Core case

---
 modules/platform-node/node-document.ts | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/modules/platform-node/node-document.ts b/modules/platform-node/node-document.ts
index b0a9883c2..6b6866b2c 100644
--- a/modules/platform-node/node-document.ts
+++ b/modules/platform-node/node-document.ts
@@ -31,9 +31,10 @@ export function parseDocument (documentHtml: string): any {
   // Build entire doc <!doctype><html> etc
   if (documentHtml.indexOf('<html>') > -1 && documentHtml.indexOf('</html>') > -1) {
     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
-  doc = parseFragment(documentHtml);
   
 
   let rootNode = undefined;