(doc: Document, html: string)
| 120 | } |
| 121 | |
| 122 | export function insertDomInDocument(doc: Document, html: string) { |
| 123 | // Get HTML contents of the `<app>`, create a DOM element and append it into the body. |
| 124 | const container = convertHtmlToDom(html, doc); |
| 125 | |
| 126 | // If there was a client render mode marker present in HTML - apply it to the <body> |
| 127 | // element as well. |
| 128 | const hasClientModeMarker = new RegExp(` ${CLIENT_RENDER_MODE_FLAG}`, 'g').test(html); |
| 129 | if (hasClientModeMarker) { |
| 130 | doc.body.setAttribute(CLIENT_RENDER_MODE_FLAG, ''); |
| 131 | } |
| 132 | |
| 133 | Array.from(container.childNodes).forEach((node) => doc.body.appendChild(node)); |
| 134 | } |
| 135 | |
| 136 | /** |
| 137 | * This prepares the environment before hydration begins. |
no test coverage detected
searching dependent graphs…