#425 fix querystring detection in pathname mode

This commit is contained in:
Leo Horie 2015-01-25 23:27:35 -05:00
parent b38b0ade0c
commit f9df39f5f7

View file

@ -594,8 +594,10 @@ var m = (function app(window, undefined) {
}; };
var listener = m.route.mode === "hash" ? "onhashchange" : "onpopstate"; var listener = m.route.mode === "hash" ? "onhashchange" : "onpopstate";
window[listener] = function() { window[listener] = function() {
if (currentRoute != normalizeRoute($location[m.route.mode])) { var path = $location[m.route.mode]
redirect($location[m.route.mode]) if (m.route.mode === "pathname") path += $location.search
if (currentRoute != normalizeRoute(path)) {
redirect(path)
} }
}; };
computePostRedrawHook = setScroll; computePostRedrawHook = setScroll;
@ -638,7 +640,9 @@ var m = (function app(window, undefined) {
return routeParams[key] return routeParams[key]
}; };
m.route.mode = "search"; m.route.mode = "search";
function normalizeRoute(route) {return route.slice(modes[m.route.mode].length)} function normalizeRoute(route) {
return route.slice(modes[m.route.mode].length)
}
function routeByValue(root, router, path) { function routeByValue(root, router, path) {
routeParams = {}; routeParams = {};