diff --git a/src/purify.js b/src/purify.js index c322fd6b..d0ba6669 100644 --- a/src/purify.js +++ b/src/purify.js @@ -844,7 +844,9 @@ function createDOMPurify(window = getGlobal()) { if (!doc || !doc.documentElement) { doc = implementation.createDocument(NAMESPACE, 'template', null); try { - doc.documentElement.innerHTML = IS_EMPTY_INPUT ? '' : dirtyPayload; + doc.documentElement.innerHTML = IS_EMPTY_INPUT + ? emptyHTML + : dirtyPayload; } catch (_) { // Syntax error if dirtyPayload is invalid xml }