diff --git a/mithril.js b/mithril.js index 08586738..77e103c2 100644 --- a/mithril.js +++ b/mithril.js @@ -744,7 +744,12 @@ var renderService = function($window) { function render(dom, vnodes) { var hooks = [] var active = $doc.activeElement - if (dom.vnodes == null) dom.vnodes = [] + + // First time rendering into a node clears it out + if (dom.vnodes == null) { + dom.vnodes = [] + dom.textContent = ""; + } if (!(vnodes instanceof Array)) vnodes = [vnodes] updateNodes(dom, dom.vnodes, Vnode.normalizeChildren(vnodes), hooks, null, undefined) dom.vnodes = vnodes diff --git a/mithril.min.js b/mithril.min.js index 83a9f417..4cef2674 100644 --- a/mithril.min.js +++ b/mithril.min.js @@ -23,18 +23,18 @@ c.tag.onbeforeremove.call(c.state,c,b));if(0a.indexOf("?")?"?":"&";a+=g+d}return a}function d(a){try{return""!==a?JSON.parse(a):null}catch(b){throw Error(a);}}function g(a){return a.responseText}function p(a,b){if("function"===typeof a)if(b instanceof Array)for(var d=0;dk.status)q(p(f.type, -a));else{var b=Error(k.responseText),d;for(d in a)b[d]=a[d];q.error(b)}}catch(h){q.error(h)}"function"===typeof m&&m()}};l?k.send(f.data):k.send();return q},jsonp:function(f){var d=C.stream();void 0!==f.initialValue&&d(f.initialValue);var g=f.callbackName||"_mithril_"+Math.round(1E16*Math.random())+"_"+l++,k=a.document.createElement("script");a[g]=function(b){k.parentNode.removeChild(k);d(p(f.type,b));"function"===typeof m&&m();delete a[g]};k.onerror=function(){k.parentNode.removeChild(k);d.error(Error("JSONP request failed")); -"function"===typeof m&&m();delete a[g]};null==f.data&&(f.data={});f.url=b(f.url,f.data);f.data[f.callbackKey||"callback"]=g;k.src=h(f.url,f.data);a.document.documentElement.appendChild(k);return d},setCompletionCallback:function(a){m=a}}}(window),H=function(){var a=[];return{subscribe:a.push.bind(a),unsubscribe:function(b){b=a.indexOf(b);-1a.indexOf("?")?"?":"&";a+=g+d}return a}function d(a){try{return""!==a?JSON.parse(a):null}catch(b){throw Error(a);}}function g(a){return a.responseText}function p(a,b){if("function"===typeof a)if(b instanceof Array)for(var d=0;dk.status)q(p(f.type,a));else{var b=Error(k.responseText),d;for(d in a)b[d]=a[d];q.error(b)}}catch(h){q.error(h)}"function"===typeof m&&m()}};l?k.send(f.data):k.send();return q},jsonp:function(f){var d=C.stream();void 0!==f.initialValue&&d(f.initialValue);var g=f.callbackName||"_mithril_"+Math.round(1E16*Math.random())+"_"+l++,k=a.document.createElement("script");a[g]=function(b){k.parentNode.removeChild(k);d(p(f.type,b));"function"===typeof m&&m();delete a[g]};k.onerror= +function(){k.parentNode.removeChild(k);d.error(Error("JSONP request failed"));"function"===typeof m&&m();delete a[g]};null==f.data&&(f.data={});f.url=b(f.url,f.data);f.data[f.callbackKey||"callback"]=g;k.src=h(f.url,f.data);a.document.documentElement.appendChild(k);return d},setCompletionCallback:function(a){m=a}}}(window),H=function(){var a=[];return{subscribe:a.push.bind(a),unsubscribe:function(b){b=a.indexOf(b);-1