Skip to content

Commit 10e2b26

Browse files
committed
Fix frame resizing after running scripts in FF
1 parent 1640d6e commit 10e2b26

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

html/js/sandbox.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,10 +114,11 @@
114114
if (last.src) {
115115
last.addEventListener("load", finish);
116116
} else {
117-
var id = Math.floor(Math.random() * 0xffffff), fin;
117+
var id = Math.floor(Math.random() * 0xffffff);
118118
this.callbacks[id] = function() { delete sandbox.callbacks[id]; finish(); };
119-
scriptTags.push(fin = document.createElement("script"));
120-
fin.innerText = "__sandbox.callbacks[" + id + "]();";
119+
var fin = doc.createElement("script");
120+
fin.text = "__sandbox.callbacks[" + id + "]();";
121+
scriptTags.push(fin);
121122
}
122123
scriptTags.forEach(function(tag) { doc.body.appendChild(tag); });
123124
} else {
@@ -178,7 +179,7 @@
178179
};
179180
},
180181
resizeFrame: function() {
181-
this.frame.style.height = Math.max(80, Math.min(this.win.document.body.scrollHeight + 10, 500)) + "px";
182+
this.frame.style.height = Math.max(80, Math.min(this.win.document.body.scrollHeight + 20, 500)) + "px";
182183
var box = this.frame.getBoundingClientRect();
183184
if (box.bottom > box.top && box.top >= 0 && box.top < window.innerHeight && box.bottom > window.innerHeight)
184185
window.scrollBy(0, Math.min(box.top, box.bottom - window.innerHeight));

0 commit comments

Comments
 (0)