diff options
Diffstat (limited to 'src/shell.html')
-rw-r--r-- | src/shell.html | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/shell.html b/src/shell.html index cbf8c0d8..226f12b9 100644 --- a/src/shell.html +++ b/src/shell.html @@ -1222,7 +1222,7 @@ postRun: [], print: (function() { var element = document.getElementById('output'); - element.value = ''; // clear browser cache + if (element) element.value = ''; // clear browser cache return function(text) { text = Array.prototype.slice.call(arguments).join(' '); // These replacements are necessary if you render to raw HTML @@ -1230,8 +1230,11 @@ //text = text.replace(/</g, "<"); //text = text.replace(/>/g, ">"); //text = text.replace('\n', '<br>', 'g'); - element.value += text + "\n"; - element.scrollTop = element.scrollHeight; // focus on bottom + console.log(text); + if (element) { + element.value += text + "\n"; + element.scrollTop = element.scrollHeight; // focus on bottom + } }; })(), printErr: function(text) { @@ -1239,7 +1242,7 @@ if (0) { // XXX disabled for safety typeof dump == 'function') { dump(text + '\n'); // fast, straight to the real console } else { - console.log(text); + console.error(text); } }, canvas: document.getElementById('canvas'), |