diff --git a/src/generators/dom/visitors/RawMustacheTag.ts b/src/generators/dom/visitors/RawMustacheTag.ts index ab0ff7991d..bbdbc5b26f 100644 --- a/src/generators/dom/visitors/RawMustacheTag.ts +++ b/src/generators/dom/visitors/RawMustacheTag.ts @@ -26,8 +26,10 @@ export default function visitRawMustacheTag( let detach: string; let insert: (content: string) => string; + let useInnerHTML = false; if (anchorBefore === 'null' && anchorAfter === 'null') { + useInnerHTML = true; detach = `${state.parentNode}.innerHTML = '';`; insert = content => `${state.parentNode}.innerHTML = ${content};`; } else if (anchorBefore === 'null') { @@ -48,7 +50,7 @@ export default function visitRawMustacheTag( node, name, content => deindent` - ${detach} + ${!useInnerHTML && detach} ${insert(content)} ` );