diff --git a/mithril.js b/mithril.js index 5edc18af..e8c32a0e 100644 --- a/mithril.js +++ b/mithril.js @@ -494,6 +494,7 @@ var renderService = function($window) { if (old != null) { for (var key in old) { if (attrs == null || !(key in attrs)) { + if (key === "className") key = "class" if (key[0] === "o" && key[1] === "n" && !isLifecycleMethod(key)) updateEvent(vnode, key, undefined) else if (key !== "key") vnode.dom.removeAttribute(key) } @@ -1122,7 +1123,7 @@ var coreRouter = function($window) { } m.route = function($window, mount1) { var router = coreRouter($window) - var globalId, currentComponent, currentRender, currentArgs, currentPath + var currentResolve, currentComponent, currentRender, currentArgs, currentPath var RouteComponent = {view: function() { return currentRender(Vnode(currentComponent, null, currentArgs, undefined, undefined, undefined)) }} @@ -1135,12 +1136,11 @@ m.route = function($window, mount1) { currentArgs = null mount1(root, RouteComponent) router.defineRoutes(routes, function(payload, args, path) { - var resolutionIdentifier = globalId = {} var isResolver = typeof payload.view !== "function" var render = defaultRender - function resolve (component) { - if (resolutionIdentifier !== globalId) return - globalId = null + var resolve = currentResolve = function (component) { + if (resolve !== currentResolve) return + currentResolve = null currentComponent = component != null ? component : isResolver ? "div" : payload currentRender = render currentArgs = args diff --git a/mithril.min.js b/mithril.min.js index a45a8e48..b57fced5 100644 --- a/mithril.min.js +++ b/mithril.min.js @@ -1,30 +1,30 @@ -new function(){function x(b,f,n,h,k,l){return{tag:b,key:f,attrs:n,children:h,text:k,dom:l,domSize:void 0,state:{},events:void 0,instance:void 0,skip:!1}}function y(b){if(null==b||"string"!==typeof b&&null==b.view)throw Error("The selector must be either a string or a component.");if("string"===typeof b&&void 0===F[b]){for(var f,n,h=[],k={};f=P.exec(b);){var l=f[1],m=f[2];""===l&&""!==m?n=m:"#"===l?k.id=m:"."===l?h.push(m):"["===f[3][0]&&((l=f[6])&&(l=l.replace(/\\(["'])/g,"$1").replace(/\\\\/g,"\\")), +new function(){function x(b,f,n,h,k,l){return{tag:b,key:f,attrs:n,children:h,text:k,dom:l,domSize:void 0,state:{},events:void 0,instance:void 0,skip:!1}}function z(b){if(null==b||"string"!==typeof b&&null==b.view)throw Error("The selector must be either a string or a component.");if("string"===typeof b&&void 0===F[b]){for(var f,n,h=[],k={};f=P.exec(b);){var l=f[1],m=f[2];""===l&&""!==m?n=m:"#"===l?k.id=m:"."===l?h.push(m):"["===f[3][0]&&((l=f[6])&&(l=l.replace(/\\(["'])/g,"$1").replace(/\\\\/g,"\\")), k[f[4]]=l||!0)}0=v&&A>=E;){var r=a[v],u=e[E];if(r===u)v++,E++;else if(null!=r&&null!=u&&r.key===u.key)v++,E++,l(c,r,u,b,w(a,v,g),p,h),p&&r.tag===u.tag&&q(c,m(r),g);else if(r=a[k],r===u)k--,E++;else if(null!=r&&null!=u&&r.key===u.key)l(c,r,u,b,w(a,k+1,g),p,h),E=v&&A>=E;){r=a[k];u=e[A];if(r===u)k--;else if(null!=r&&null!=u&&r.key===u.key)l(c,r,u,b,w(a,k+1,g),p,h),p&&r.tag===u.tag&&q(c,m(r),g),null!=r.dom&&(g=r.dom),k--;else{if(!t){t=a;var r=k,C={},z;for(z=0;z=v&&A>=E;){r=a[k];u=e[A];if(r===u)k--;else if(null!=r&&null!=u&&r.key===u.key)l(c,r,u,b,w(a,k+1,g),p,h),p&&r.tag===u.tag&&q(c,m(r),g),null!=r.dom&&(g=r.dom),k--;else{if(!t){t=a;var r=k,C={},y;for(y=0;yb.indexOf("?")?"?":"&";b+=h+f}return b}function k(b){try{return""!==b?JSON.parse(b):null}catch(g){throw Error(b); }}function l(b){return b.responseText}function m(b,g){if("function"===typeof b)if(g instanceof Array)for(var f=0;f