on master help sign in
Fix two bugs: (1) Reported text size was incorrect for headers. (2) The outermost div was not resized properly.
58bb15devancz
core-js/Element.js+1−1
@@ -67,7 +67,7 @@ var Element = function() {
67 var w = e.style.width ? e.style.width.slice(0,-2) : 0;
67 var w = e.style.width ? e.style.width.slice(0,-2) : 0;
68
68
69 var t = newElement('div');
69 var t = newElement('div');
70− t.innerHTML = " " + e.innerHTML;
70+ t.innerHTML = e.innerHTML;
71 t.style.textAlign = e.style.textAlign;
71 t.style.textAlign = e.style.textAlign;
72 if (w > 0) { t.style.width = w + "px"; }
72 if (w > 0) { t.style.width = w + "px"; }
73
73
core-js/runtime/Dispatcher.js+4−9
@@ -110,18 +110,13 @@ var Dispatcher = function() {
110
110
111 var initialize = function() {
111 var initialize = function() {
112 var prog = ElmCode.hasOwnProperty("main") ? ElmCode.main : main;
112 var prog = ElmCode.hasOwnProperty("main") ? ElmCode.main : main;
113− try { program = prog(); } catch (e) {
113+ try { program = prog(); } catch (e) { throw 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− }
119 if (!program.hasOwnProperty('recv')) {
114 if (!program.hasOwnProperty('recv')) {
120 program = Elm.Input(program);
115 program = Elm.Input(program);
121 }
116 }
122 var content = document.getElementById('content');
117 var content = document.getElementById('content');
123 content.appendChild(program.value);
118 content.appendChild(program.value);
124− correctSize(content);
119+ adjust();
125 var w = document.getElementById('widthChecker').offsetWidth;
120 var w = document.getElementById('widthChecker').offsetWidth;
126 if (w !== window.innerWidth) {
121 if (w !== window.innerWidth) {
127 Dispatcher.notify(Window.dimensions.id, Value.Tuple(w, window.innerHeight));
122 Dispatcher.notify(Window.dimensions.id, Value.Tuple(w, window.innerHeight));
@@ -129,13 +124,13 @@ var Dispatcher = function() {
129 program = Elm.Lift(function(value) {
124 program = Elm.Lift(function(value) {
130 var content = document.getElementById('content');
125 var content = document.getElementById('content');
131 content.replaceChild(value, content.children[0]);
126 content.replaceChild(value, content.children[0]);
132− correctSize(content);
127+ adjust();
133 return value;
128 return value;
134 }, [program]);
129 }, [program]);
135 };
130 };
136 var adjust = function() {
131 var adjust = function() {
137 var content = document.getElementById('content');
132 var content = document.getElementById('content');
138− correctSize(content);
133+ correctSize(content.children[0]);
139 }
134 }
140 var notify = function(id, v) {
135 var notify = function(id, v) {
141 timestep += 1;
136 timestep += 1;