on master help sign in
Remove DOM update code in favor of naive update mechanism (replace everything). Not ideal, but should be added back when Element model is more robust.
fc6bcf6evancz
core-js/runtime/Dispatcher.js+1−29
@@ -54,34 +54,6 @@ var Elm = function() {
54
54
55var Dispatcher = function() {
55var Dispatcher = function() {
56 var program = null;
56 var program = null;
57− var update = function(context, newNode, oldNode) {
58− if (oldNode.style && newNode.style) {
59− oldNode.style.width = newNode.style.width;
60− oldNode.style.height = newNode.style.height;
61− }
62− if (newNode.hasOwnProperty('isElmLeaf') &&
63− oldNode.hasOwnProperty('isElmLeaf')) {
64− newNode.id = oldNode.id;
65− if (!newNode.isEqualNode(oldNode)) {
66− context.replaceChild(newNode, oldNode);
67− }
68− return;
69− }
70− if (newNode.nodeName === "CANVAS") {
71− context.replaceChild(newNode, oldNode);
72− return;
73− }
74− var nlist = newNode.childNodes;
75− var olist = oldNode.childNodes;
76− if (nlist.length !== olist.length) {
77− context.replaceChild(newNode, oldNode);
78− return;
79− }
80− for (var i = nlist.length; i--; ) {
81− update(oldNode, nlist[i], olist[i]);
82− }
83− };
84−
85 var correctSize = function(e) {
57 var correctSize = function(e) {
86 var kids = e.childNodes;
58 var kids = e.childNodes;
87 var len = kids.length;
59 var len = kids.length;
@@ -142,7 +114,7 @@ var Dispatcher = function() {
142 var notify = function(id, v) {
114 var notify = function(id, v) {
143 if (program.step(id,v)) {
115 if (program.step(id,v)) {
144 var content = document.getElementById('content');
116 var content = document.getElementById('content');
145− update(content, program.value, content.children[0]);
117+ content.replaceChild(program.value, content.children[0]);
146 correctSize(content);
118 correctSize(content);
147 }
119 }
148 };
120 };