Skip to content
This repository was archived by the owner on Sep 30, 2020. It is now read-only.

Commit b7b823f

Browse files
committed
Merge pull request #132 from dguenther/fix-IE-playpen-link
Fix play link not appearing in IE
2 parents aa1e14e + 77e6510 commit b7b823f

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

_includes/editor.js

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,17 @@
6161
// Set initial size to match initial content
6262
updateEditorHeight();
6363

64+
// Safely remove all content from the result div
65+
function clearResultDiv() {
66+
// Clearing the result div will break our reference to
67+
// the playlink icon, so let's save it if it exists
68+
var newPlayLink = document.getElementById("playlink");
69+
if (newPlayLink) {
70+
playLink = resultDiv.removeChild(newPlayLink);
71+
}
72+
resultDiv.innerHTML = "";
73+
}
74+
6475
function escapeHTML(unsafe) {
6576
return unsafe
6677
.replace(/&/g, "&")
@@ -123,6 +134,7 @@
123134
function handleResult(statusCode, message) {
124135
// Dispatch depending on result type
125136
if (result == null) {
137+
clearResultDiv();
126138
resultDiv.style.backgroundColor = errorColor;
127139
resultDiv.innerHTML = errMsg;
128140
} else if (statusCode === SUCCESS) {
@@ -213,6 +225,7 @@
213225
// Registering handler for run button click
214226
runButton.addEventListener("click", function(ev) {
215227
resultDiv.style.display = "block";
228+
clearResultDiv();
216229
resultDiv.innerHTML = "Running...";
217230

218231
// clear previous markers, if any
@@ -229,7 +242,7 @@
229242
encodeURIComponent(program) + "&run=1";
230243
playLink.href = programUrl;
231244

232-
resultDiv.innerHTML = ''; // clear resultDiv, then add
245+
clearResultDiv(); // clear resultDiv, then add
233246
resultDiv.appendChild(playLink); // playLink icon and message
234247
resultDiv.innerHTML += message;
235248
}

0 commit comments

Comments
 (0)