Check that the 2nd argument to m.route is a string

This commit is contained in:
Richard Eames 2014-09-18 10:57:30 -06:00
parent e94a0a7c22
commit c3d3fa7315
2 changed files with 33 additions and 1 deletions

View file

@ -517,7 +517,7 @@ Mithril = m = new function app(window, undefined) {
var redirect = function() {}, routeParams = {}, currentRoute
m.route = function() {
if (arguments.length === 0) return currentRoute
else if (arguments.length === 3 && typeof arguments[1] == "string") {
else if (arguments.length === 3 && isStr(arguments[1])) {
var root = arguments[0], defaultRoute = arguments[1], router = arguments[2]
redirect = function(source) {
var path = currentRoute = normalizeRoute(source)