Merge remote-tracking branch 'origin/rewrite' into rewrite

This commit is contained in:
Leo 2016-12-23 08:51:23 -05:00
commit befc1e6d1a
4 changed files with 8 additions and 6 deletions

View file

@ -15,7 +15,7 @@ module.exports = function($window, redrawService) {
if (render != null) redrawService.render(root, render(Vnode(component, attrs.key, attrs)))
}
var bail = function() {
routeService.setPath(defaultRoute)
routeService.setPath(defaultRoute, null, { replace: true })
}
routeService.defineRoutes(routes, function(payload, params, path) {
var update = lastUpdate = function(routeResolver, comp) {

View file

@ -51,7 +51,7 @@ o.spec("route", function() {
o(root.firstChild.nodeName).equals("DIV")
})
o("routed mount points can redraw synchronoulsy (#1275)", function() {
o("routed mount points can redraw synchronously (#1275)", function() {
var view = o.spy()
$window.location.href = prefix + "/"
@ -78,6 +78,8 @@ o.spec("route", function() {
callAsync(function() {
o(root.firstChild.nodeName).equals("DIV")
o($window.location.pathname).equals("/a")
$window.history.back()
o($window.location.pathname).equals("/")

View file

@ -1098,7 +1098,7 @@ var _20 = function($window, redrawService0) {
if (render1 != null) redrawService0.render(root, render1(Vnode(component, attrs3.key, attrs3)))
}
var bail = function() {
routeService.setPath(defaultRoute)
routeService.setPath(defaultRoute, null, { replace: true })
}
routeService.defineRoutes(routes, function(payload, params, path) {
var update = lastUpdate = function(routeResolver, comp) {

6
mithril.min.js vendored
View file

@ -36,6 +36,6 @@ decodeURIComponent(g[1]):"";"true"===g?g=!0:"false"===g&&(g=!1);var l=m.split(/\
l&&(l=m(function(){l=null;a()}))}}function d(a,c,d){var b=a.indexOf("?"),g=a.indexOf("#"),k=-1<b?b:-1<g?g:a.length;if(-1<b){var b=L(a.slice(b+1,-1<g?g:a.length)),h;for(h in b)c[h]=b[h]}if(-1<g)for(h in c=L(a.slice(g+1)),c)d[h]=c[h];return a.slice(0,k)}var g="function"===typeof a.history.pushState,m="function"===typeof setImmediate?setImmediate:setTimeout,l,n={prefix:"#!",getPath:function(){switch(n.prefix.charAt(0)){case "#":return c("hash").slice(n.prefix.length);case "?":return c("search").slice(n.prefix.length)+
c("hash");default:return c("pathname").slice(n.prefix.length)+c("search")+c("hash")}},setPath:function(c,k,h){var b={},l={};c=d(c,b,l);if(null!=k){for(var q in k)b[q]=k[q];c=c.replace(/:([^\/]+)/g,function(a,c){delete b[c];return k[c]})}(q=H(b))&&(c+="?"+q);(l=H(l))&&(c+="#"+l);g?(l=h?h.state:null,q=h?h.title:null,a.onpopstate(),h&&h.replace?a.history.replaceState(l,q,n.prefix+c):a.history.pushState(l,q,n.prefix+c)):a.location.href=n.prefix+c},defineRoutes:function(c,k,l){function b(){var b=n.getPath(),
g={},h=d(b,g,g),m=a.history.state;if(null!=m)for(var t in m)g[t]=m[t];for(var p in c)if(m=new RegExp("^"+p.replace(/:[^\/]+?\.{3}/g,"(.*?)").replace(/:[^\/]+/g,"([^\\/]+)")+"/?$"),m.test(h)){h.replace(m,function(){for(var a=p.match(/:[^\/]+/g)||[],d=[].slice.call(arguments,1,-2),h=0;h<a.length;h++)g[a[h].replace(/:|\./g,"")]=decodeURIComponent(d[h]);k(c[p],g,b,p)});return}l(b,g)}g?a.onpopstate=h(b):"#"===n.prefix.charAt(0)&&(a.onhashchange=b);b()}};return n};z.route=function(a,c){var h=T(a),d=function(a){return a},
g,m,l,n,p,k=function(a,b,k){if(null==a)throw Error("Ensure the DOM element that was passed to `m.route` is not undefined");var q=function(){null!=g&&c.render(a,g(u(m,l.key,l)))},t=function(){h.setPath(b)};h.defineRoutes(k,function(a,b,c){var h=p=function(a,k){h===p&&(m=null!=k&&"function"===typeof k.view?k:"div",l=b,n=c,p=null,g=(a.render||d).bind(a),q())};a.view?h({},a):a.onmatch?D.resolve(a.onmatch(b,c)).then(function(b){h(a,b)},t):h(a,"div")},t);c.subscribe(a,q)};k.set=function(a,b,c){null!=p&&
(c={replace:!0});p=null;h.setPath(a,b,c)};k.get=function(){return n};k.prefix=function(a){h.prefix=a};k.link=function(a){a.dom.setAttribute("href",h.prefix+a.attrs.href);a.dom.onclick=function(a){a.ctrlKey||a.metaKey||a.shiftKey||2===a.which||(a.preventDefault(),a.redraw=!1,a=this.getAttribute("href"),0===a.indexOf(h.prefix)&&(a=a.slice(h.prefix.length)),k.set(a,void 0,void 0))}};return k}(window,I);z.withAttr=function(a,c,h){return function(d){return c.call(h||this,a in d.currentTarget?d.currentTarget[a]:
d.currentTarget.getAttribute(a))}};G=O(window);z.render=G.render;z.redraw=I.redraw;z.request=K.request;z.jsonp=K.jsonp;z.parseQueryString=L;z.buildQueryString=H;z.version="1.0.0-rc.6";z.vnode=u;"undefined"!==typeof module?module.exports=z:window.m=z};
g,m,l,n,p,k=function(a,b,k){if(null==a)throw Error("Ensure the DOM element that was passed to `m.route` is not undefined");var q=function(){null!=g&&c.render(a,g(u(m,l.key,l)))},t=function(){h.setPath(b,null,{replace:!0})};h.defineRoutes(k,function(a,b,c){var h=p=function(a,k){h===p&&(m=null!=k&&"function"===typeof k.view?k:"div",l=b,n=c,p=null,g=(a.render||d).bind(a),q())};a.view?h({},a):a.onmatch?D.resolve(a.onmatch(b,c)).then(function(b){h(a,b)},t):h(a,"div")},t);c.subscribe(a,q)};k.set=function(a,
b,c){null!=p&&(c={replace:!0});p=null;h.setPath(a,b,c)};k.get=function(){return n};k.prefix=function(a){h.prefix=a};k.link=function(a){a.dom.setAttribute("href",h.prefix+a.attrs.href);a.dom.onclick=function(a){a.ctrlKey||a.metaKey||a.shiftKey||2===a.which||(a.preventDefault(),a.redraw=!1,a=this.getAttribute("href"),0===a.indexOf(h.prefix)&&(a=a.slice(h.prefix.length)),k.set(a,void 0,void 0))}};return k}(window,I);z.withAttr=function(a,c,h){return function(d){return c.call(h||this,a in d.currentTarget?
d.currentTarget[a]:d.currentTarget.getAttribute(a))}};G=O(window);z.render=G.render;z.redraw=I.redraw;z.request=K.request;z.jsonp=K.jsonp;z.parseQueryString=L;z.buildQueryString=H;z.version="1.0.0-rc.6";z.vnode=u;"undefined"!==typeof module?module.exports=z:window.m=z};