Merge pull request #452 from nordfjord/next

always select exact route if it exists
This commit is contained in:
Leo Horie 2015-02-10 09:47:47 -05:00
commit 2369586167

View file

@ -120,7 +120,7 @@ var m = (function app(window, undefined) {
len = data.length
}
}
var nodes = [], intact = cached.length === data.length, subArrayCount = 0;
//keys algorithm: sort elements without recreating them if keys are present
@ -654,6 +654,15 @@ var m = (function app(window, undefined) {
path = path.substr(0, queryStart)
}
// Get all routes and check if there's
// an exact match for the current path
var keys = Object.keys(router);
var index = keys.indexOf(path);
if(index !== -1){
m.module(root, router[keys [index]]);
return true;
}
for (var route in router) {
if (route === path) {
m.module(root, router[route]);