Skip to content

Commit 7fd65b6

Browse files
committed
No reason to do string replacement, just use a text node
1 parent e2aadd3 commit 7fd65b6

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

snippet.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// MIT license, see: https://github.com/tjcrowder/simple-snippets-console/blob/master/LICENSE
22
var snippet = {
3-
version: "1.2",
3+
version: "1.3",
44

55
// Writes out the given text in a monospaced paragraph tag, escaping
66
// & and < so they aren't rendered as HTML.
@@ -13,7 +13,7 @@ var snippet = {
1313
} else if (typeof msg === "object") {
1414
msg = msg === null ? "null" : JSON.stringify(msg);
1515
}
16-
elm.innerHTML = msg.replace(/&/g, '&amp;').replace(/</g, '&lt;');
16+
elm.appendChild(document.createTextNode(msg));
1717
document.body.appendChild(elm);
1818
},
1919

0 commit comments

Comments
 (0)