aboutsummaryrefslogtreecommitdiff
path: root/src/shell.html
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2012-03-05 14:25:06 -0800
committerAlon Zakai <alonzakai@gmail.com>2012-03-05 14:25:06 -0800
commit73d6511550ec7ac895818b74360e87f799fd9171 (patch)
treef3ea31052a7deca951e6dc42b2881aca1ab2627c /src/shell.html
parent1af7db58eefaa110f2748b7c4dd52f8d022f9aa6 (diff)
properly handle html-unfriendly print() output
Diffstat (limited to 'src/shell.html')
-rw-r--r--src/shell.html5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/shell.html b/src/shell.html
index 69217b18..a41086b9 100644
--- a/src/shell.html
+++ b/src/shell.html
@@ -19,7 +19,10 @@
print: (function() {
var element = document.getElementById('output');
return function(text) {
- element.innerHTML += text.replace('\n', '<br>', 'g') + '<br>';
+ text = text.replace(/</g, "&lt;");
+ text = text.replace(/>/g, "&gt;");
+ text = text.replace('\n', '<br>', 'g');
+ element.innerHTML += text + '<br>';
};
})(),
canvas: document.getElementById('canvas')