on master help sign in
Fix two bugs: (1) Reported text size was incorrect for headers. (2) The outermost div was not resized properly.
commit58bb15d89e9ca7f4edae22e219046d257595ff0f authorevancz <info@elm-lang.org> dateFri 15 Jun 2012, 03:23 (14 years ago) parent0bef882
2 files changed+5−10
core-js/Element.js+1−1 core-js/runtime/Dispatcher.js+4−9
core-js/Element.js+1−1
@@ -67,7 +67,7 @@ var Element = function() {
6767 var w = e.style.width ? e.style.width.slice(0,-2) : 0;
6868
6969 var t = newElement('div');
70− t.innerHTML = "&nbsp;" + e.innerHTML;
70+ t.innerHTML = e.innerHTML;
7171 t.style.textAlign = e.style.textAlign;
7272 if (w > 0) { t.style.width = w + "px"; }
7373
core-js/runtime/Dispatcher.js+4−9
@@ -110,18 +110,13 @@ var Dispatcher = function() {
110110
111111 var initialize = function() {
112112 var prog = ElmCode.hasOwnProperty("main") ? ElmCode.main : main;
113− try { program = prog(); } catch (e) {
114− var msg = ("<br><h2>Your browser may not be supported. Are you using a modern browser?</h2>" +
115− "<br><span style=\"grey\">Runtime Error:<br>" + e + "</span>")
116− document.body.innerHTML = Text.monospace(msg);
117− throw e;
118− }
113+ try { program = prog(); } catch (e) { throw e; }
119114 if (!program.hasOwnProperty('recv')) {
120115 program = Elm.Input(program);
121116 }
122117 var content = document.getElementById('content');
123118 content.appendChild(program.value);
124− correctSize(content);
119+ adjust();
125120 var w = document.getElementById('widthChecker').offsetWidth;
126121 if (w !== window.innerWidth) {
127122 Dispatcher.notify(Window.dimensions.id, Value.Tuple(w, window.innerHeight));
@@ -129,13 +124,13 @@ var Dispatcher = function() {
129124 program = Elm.Lift(function(value) {
130125 var content = document.getElementById('content');
131126 content.replaceChild(value, content.children[0]);
132− correctSize(content);
127+ adjust();
133128 return value;
134129 }, [program]);
135130 };
136131 var adjust = function() {
137132 var content = document.getElementById('content');
138− correctSize(content);
133+ correctSize(content.children[0]);
139134 }
140135 var notify = function(id, v) {
141136 timestep += 1;