@@ -11,10 +11,15 @@ Elm.fullscreen = function(module) {
1111 return init(ElmRuntime.Display.FULLSCREEN, document.body, module);
1212};
1313
14−Elm.node = function(width, height, module) {
15− var container = document.createElement('div');
16− container.style.width = width + 'px';
17− container.style.height = height + 'px';
14+Elm.byId = function(id, module) {
15+ var container = document.getElementById(id);
16+ var tag = container.tagName;
17+ if (tag !== 'DIV') {
18+ throw new Error('Elm.byId must be given a div, not a ' + tag + '.');
19+ }
20+ while (container.hasChildNodes()) {
21+ container.removeChild(container.lastChild);
22+ }
1823 return init(ElmRuntime.Display.COMPONENT, container, module);
1924};
2025