fix handling of + in parseQuerystring

This commit is contained in:
Leo Horie 2014-08-16 17:06:27 -04:00
parent 08c8caff89
commit 936e2034a7
2 changed files with 17 additions and 1 deletions

View file

@ -521,7 +521,7 @@ Mithril = m = new function app(window, undefined) {
path.replace(matcher, function() {
var keys = route.match(/:[^\/]+/g) || []
var values = [].slice.call(arguments, 1, -2)
for (var i = 0; i < keys.length; i++) routeParams[keys[i].replace(/:|\./g, "")] = decodeSpace(values[i])
for (var i = 0; i < keys.length; i++) routeParams[keys[i].replace(/:|\./g, "")] = decodeURIComponent(values[i])
m.module(root, router[route])
})
return true

View file

@ -1412,6 +1412,22 @@ function testMithril(mock) {
mock.requestAnimationFrame.$resolve() //teardown
return count == 2
})
test(function() {
mock.requestAnimationFrame.$resolve() //setup
mock.location.search = "?"
var root = mock.document.createElement("div")
var value
m.route(root, "/foo+bar", {
"/:arg": {
controller: function() {value = m.route.param("arg")},
view: function(ctrl) {
return ""
}
}
})
return value == "foo+bar"
})
//end m.route
//m.prop