From ca53ae8caaf633df065ff3ff6a40b50bd32dc65b Mon Sep 17 00:00:00 2001 From: Gandalf-the-Bot Date: Fri, 4 Nov 2016 20:10:43 +0000 Subject: [PATCH] Bundled output for commit a442b9961c3541044202accce13bffe82b1d726b [skip ci] --- mithril.js | 24 ++++++++------ mithril.min.js | 88 +++++++++++++++++++++++++------------------------- 2 files changed, 58 insertions(+), 54 deletions(-) diff --git a/mithril.js b/mithril.js index 60e45911..01eea041 100644 --- a/mithril.js +++ b/mithril.js @@ -541,7 +541,7 @@ var _14 = function($window) { function updateNodes(parent0, old, vnodes, hooks, nextSibling, ns) { if (old === vnodes || old == null && vnodes == null) return else if (old == null) createNodes(parent0, vnodes, 0, vnodes.length, hooks, nextSibling, undefined) - else if (vnodes == null) removeNodes(parent0, old, 0, old.length, vnodes) + else if (vnodes == null) removeNodes(old, 0, old.length, vnodes) else { var recycling = isRecyclable(old, vnodes) if (recycling) old = old.concat(old.pool) @@ -549,7 +549,7 @@ var _14 = function($window) { for (var i = 0; i < old.length; i++) { if (old[i] === vnodes[i] || old[i] == null && vnodes[i] == null) continue else if (old[i] == null) insertNode(parent0, createNode(vnodes[i], hooks, ns), getNextSibling(old, i + 1, nextSibling)) - else if (vnodes[i] == null) removeNodes(parent0, old, i, i + 1, vnodes) + else if (vnodes[i] == null) removeNodes(old, i, i + 1, vnodes) else updateNode(parent0, old[i], vnodes[i], hooks, getNextSibling(old, i + 1, nextSibling), recycling, ns) if (recycling && old[i].tag === vnodes[i].tag) insertNode(parent0, toFragment(old[i]), getNextSibling(old, i + 1, nextSibling)) } @@ -606,7 +606,7 @@ var _14 = function($window) { if (end < start) break } createNodes(parent0, vnodes, start, end + 1, hooks, nextSibling, ns) - removeNodes(parent0, old, oldStart, oldEnd + 1, vnodes) + removeNodes(old, oldStart, oldEnd + 1, vnodes) } } } @@ -630,7 +630,7 @@ var _14 = function($window) { else updateComponent(parent0, old, vnode, hooks, nextSibling, recycling, ns) } else { - removeNode(parent0, old, null) + removeNode(old, null) insertNode(parent0, createNode(vnode, hooks, undefined), nextSibling) } } @@ -698,7 +698,7 @@ var _14 = function($window) { vnode.domSize = vnode.instance.domSize } else if (old.instance != null) { - removeNode(parent0, old.instance, null) + removeNode(old.instance, null) vnode.dom = undefined vnode.domSize = 0 } @@ -761,12 +761,12 @@ var _14 = function($window) { else if (children != null || vnode.text != null) throw new Error("Child node of a contenteditable must be trusted") } //remove - function removeNodes(parent0, vnodes, start, end, context) { + function removeNodes(vnodes, start, end, context) { for (var i = start; i < end; i++) { var vnode = vnodes[i] if (vnode != null) { if (vnode.skip) vnode.skip = false - else removeNode(parent0, vnode, context) + else removeNode(vnode, context) } } } @@ -779,7 +779,7 @@ var _14 = function($window) { } } } - function removeNode(parent0, vnode, context) { + function removeNode(vnode, context) { var expected = 1, called = 0 if (vnode.attrs && vnode.attrs.onbeforeremove) { expected++ @@ -798,10 +798,10 @@ var _14 = function($window) { if (count > 1) { var dom = vnode.dom while (--count) { - parent0.removeChild(dom.nextSibling) + removeNodeFromDOM(dom.nextSibling) } } - if (vnode.dom.parentNode != null) parent0.removeChild(vnode.dom) + removeNodeFromDOM(vnode.dom) if (context != null && vnode.domSize == null && !hasIntegrationMethods(vnode.attrs) && typeof vnode.tag === "string") { //TODO test custom elements if (!context.pool) context.pool = [vnode] else context.pool.push(vnode) @@ -810,6 +810,10 @@ var _14 = function($window) { } } } + function removeNodeFromDOM(node) { + var parent0 = node.parentNode + if (parent0 != null) parent0.removeChild(node) + } function onremove(vnode) { if (vnode.attrs && vnode.attrs.onremove) vnode.attrs.onremove.call(vnode.state, vnode) if (typeof vnode.tag !== "string" && vnode.tag.onremove) vnode.tag.onremove.call(vnode.state, vnode) diff --git a/mithril.min.js b/mithril.min.js index 72e60855..8020bbcf 100644 --- a/mithril.min.js +++ b/mithril.min.js @@ -1,44 +1,44 @@ -new function(){function q(c,f,p,g,k,h){return{tag:c,key:f,attrs:p,children:g,text:k,dom:h,domSize:void 0,state:{},events:void 0,instance:void 0,skip:!1}}function v(c){if(null==c||"string"!==typeof c&&null==c.view)throw Error("The selector must be either a string or a component.");if("string"===typeof c&&void 0===K[c]){for(var f,p,g=[],k={};f=R.exec(c);){var h=f[1],y=f[2];""===h&&""!==y?p=y:"#"===h?k.id=y:"."===h?g.push(y):"["===f[3][0]&&((h=f[6])&&(h=h.replace(/\\(["'])/g,"$1").replace(/\\\\/g,"\\")), -k[f[4]]=h||!0)}0e.filter(I).length)throw Error("Ensure that each item passed to m.prop.combine/m.prop.merge is a stream"); -return t(f(),e,function(){var m=e.filter(d);if(0e.indexOf("?")?"?":"&";e+=g+f}return e}function k(e){try{return""!==e?JSON.parse(e):null}catch(l){throw Error(e);}}function h(e){return e.responseText}function y(e,c){if("function"===typeof e)if(c instanceof Array)for(var f=0;fx.status||304===x.status)l(y(e.type,c));else{var f=Error(x.responseText),g;for(g in c)f[g]=c[g];l.error(f)}}catch(T){l.error(T)}"function"===typeof n&&n()}};r?x.send(e.data):x.send();return l},jsonp:function(e){var l=f();void 0!==e.initialValue&&l(e.initialValue);var h=e.callbackName||"_mithril_"+Math.round(1E16*Math.random())+"_"+z++,k=c.document.createElement("script");c[h]=function(f){k.parentNode.removeChild(k);l(y(e.type,f));"function"===typeof n&&n();delete c[h]};k.onerror=function(){k.parentNode.removeChild(k); -l.error(Error("JSONP request failed"));"function"===typeof n&&n();delete c[h]};null==e.data&&(e.data={});e.url=p(e.url,e.data);e.data[e.callbackKey||"callback"]=h;k.src=g(e.url,e.data);c.document.documentElement.appendChild(k);return l},setCompletionCallback:function(c){n=c}}}(window,P),M=function(){var c=[];return{subscribe:c.push.bind(c),unsubscribe:function(f){f=c.indexOf(f);-1=k&&w>=A;){var t=a[k],u=d[A];if(t!==u||m)if(null!=t&&null!=u&&t.key===u.key)k++,A++,h(b,t,u,c,z(a,k,e),m,g),m&&t.tag===u.tag&&n(b,y(t),e);else if(t=a[r],t!==u||m)if(null!=t&&null!=u&&t.key===u.key)h(b,t,u,c,z(a,r+1,e),m,g),(m||A=k&&w>=A;){t=a[r];u=d[w];if(t!==u||m)if(null!=t&&null!=u&&t.key=== -u.key)h(b,t,u,c,z(a,r+1,e),m,g),m&&t.tag===u.tag&&n(b,y(t),e),null!=t.dom&&(e=t.dom),r--;else{if(!x){x=a;var t=r,C={},q;for(q=0;qe.filter(I).length)throw Error("Ensure that each item passed to m.prop.combine/m.prop.merge is a stream"); +return t(f(),e,function(){var n=e.filter(d);if(0e.indexOf("?")?"?":"&";e+=g+f}return e}function k(e){try{return""!==e?JSON.parse(e):null}catch(m){throw Error(e);}}function h(e){return e.responseText}function y(e,c){if("function"===typeof e)if(c instanceof Array)for(var f=0;fw.status||304===w.status)m(y(e.type,c));else{var f=Error(w.responseText),g;for(g in c)f[g]=c[g];m.error(f)}}catch(T){m.error(T)}"function"===typeof p&&p()}};x?w.send(e.data):w.send();return m},jsonp:function(e){var m=f();void 0!==e.initialValue&&m(e.initialValue);var h=e.callbackName||"_mithril_"+Math.round(1E16*Math.random())+"_"+z++,k=c.document.createElement("script");c[h]=function(f){k.parentNode.removeChild(k);m(y(e.type,f));"function"===typeof p&&p();delete c[h]};k.onerror=function(){k.parentNode.removeChild(k); +m.error(Error("JSONP request failed"));"function"===typeof p&&p();delete c[h]};null==e.data&&(e.data={});e.url=r(e.url,e.data);e.data[e.callbackKey||"callback"]=h;k.src=g(e.url,e.data);c.document.documentElement.appendChild(k);return m},setCompletionCallback:function(c){p=c}}}(window,P),M=function(){var c=[];return{subscribe:c.push.bind(c),unsubscribe:function(f){f=c.indexOf(f);-1=q&&x>=A;){var t=b[q],l=d[A];if(t!==l||n)if(null!=t&&null!=l&&t.key===l.key)q++,A++,h(a,t,l,c,z(b,q,e),n,g),n&&t.tag===l.tag&&p(a,y(t),e);else if(t=b[k],t!==l||n)if(null!=t&&null!=l&&t.key===l.key)h(a,t,l,c,z(b,k+1,e),n,g),(n||A=q&&x>=A;){t=b[k];l=d[x];if(t!==l||n)if(null!=t&&null!=l&&t.key===l.key)h(a, +t,l,c,z(b,k+1,e),n,g),n&&t.tag===l.tag&&p(a,y(t),e),null!=t.dom&&(e=t.dom),k--;else{if(!w){w=b;var t=k,C={},u;for(u=0;u