Skip to content

Commit

Permalink
fix(playground): preserve HTML comments (#11304)
Browse files Browse the repository at this point in the history
Problem: Comments were discarded when running an example in the Playground.

Solution: Clone comments as well, instead of discarding them.
  • Loading branch information
jeremyredhead authored Jul 4, 2024
1 parent c832fa5 commit e30b1a9
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion client/public/runner.html
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit e30b1a9

Please sign in to comment.