@@ -20,18 +20,8 @@ Elm.init = function(module, baseNode) {
21 // ensure that baseNode exists and is properly formatted.
21 // ensure that baseNode exists and is properly formatted.
22 if (typeof baseNode === 'undefined') {
22 if (typeof baseNode === 'undefined') {
23− var newElement = ElmRuntime.use(ElmRuntime.Render.Utils).newElement;
24− baseNode = newElement('div');
25− document.body.appendChild(baseNode);
23+ baseNode = document.body;
26− baseNode.style.width = window.innerWidth + 'px';
27− baseNode.style.height = window.innerHeight + 'px';
28− window.addEventListener('resize', function() {
29− console.log('resize the base node');
30− baseNode.style.width = window.innerWidth + 'px';
31− baseNode.style.height = window.innerHeight + 'px';
34− var style = newElement('style');
24+ var style = document.createElement('style');
35 style.type = 'text/css';
25 style.type = 'text/css';
36 style.innerHTML = "html,head,body { padding:0; margin:0; }" +
26 style.innerHTML = "html,head,body { padding:0; margin:0; }" +
37 "body { font-family: calibri, helvetica, arial, sans-serif; }";
27 "body { font-family: calibri, helvetica, arial, sans-serif; }";
@@ -71,21 +61,26 @@ Elm.init = function(module, baseNode) {
71 inputs = ElmRuntime.filterDeadInputs(inputs);
61 inputs = ElmRuntime.filterDeadInputs(inputs);
73 // Add the visualModel to the DOM
63 // Add the visualModel to the DOM
74− baseNode.appendChild(Render.render(visualModel));
64+ var renderNode = Render.render(visualModel)
65+ baseNode.appendChild(renderNode);
68+ function adjustWindow() {
76− if ('Window' in elm) {
69+ if ('Window' in elm) {
77 var w = baseNode.clientWidth;
70 var w = baseNode.clientWidth;
78 if (w !== elm.Window.dimensions.value._0) {
71 if (w !== elm.Window.dimensions.value._0) {
79− notify(elm.Window.dimensions.id,
72+ notify(elm.Window.dimensions.id,
80− Elm.Native.Utils(elm).Tuple2(w, baseNode.clientHeight));
73+ Elm.Native.Utils(elm).Tuple2(w, baseNode.clientHeight));
84 // set up updates so that the DOM is adjusted as necessary.
78 // set up updates so that the DOM is adjusted as necessary.
85 var update = Render.update;
79 var update = Render.update;
86 function domUpdate(value) {
80 function domUpdate(value) {
87− update(baseNode.firstChild, visualModel, value);
81+ update(renderNode, visualModel, value);
88 visualModel = value;
82 visualModel = value;
89 return value;
84 return value;