From e30b1a99c7b6a22b5fe393c89b074723b1aed166 Mon Sep 17 00:00:00 2001 From: "j. redhead" Date: Thu, 4 Jul 2024 11:39:37 -0500 Subject: [PATCH] fix(playground): preserve HTML comments (#11304) Problem: Comments were discarded when running an example in the Playground. Solution: Clone comments as well, instead of discarding them. --- client/public/runner.html | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/client/public/runner.html b/client/public/runner.html index 6b534bdc60f1..d3374bb6a622 100644 --- a/client/public/runner.html +++ b/client/public/runner.html @@ -62,10 +62,14 @@ parent.innerHTML = html; } else { for (const child of dummy.childNodes) { - if (child.nodeType == Node.TEXT_NODE) { + if (child.nodeType === Node.TEXT_NODE) { parent.appendChild(document.createTextNode(child.textContent)); continue; } + if (child.nodeType === Node.COMMENT_NODE) { + parent.appendChild(document.createComment(child.data)); + continue; + } if (child.nodeType !== Node.ELEMENT_NODE) { continue; }