Merge branch 'next' into components

Conflicts:
	mithril.js
This commit is contained in:
Leo Horie 2015-02-03 21:45:19 -05:00
commit 784973f168
3 changed files with 7 additions and 6 deletions

View file

@ -568,7 +568,7 @@ var m = (function app(window, undefined) {
for (var i = 0, root; root = roots[i]; i++) {
if (controllers[i]) {
var args = modules[i].controller && modules[i].controller.$$args ? [controllers[i]].concat(modules[i].controller.$$args) : [controllers[i]]
m.render(root, (modules[i].view || blank).apply(modules[i], args), forceRedraw)
m.render(root, modules[i].view ? modules[i].view(controllers[i], args) : blank(), forceRedraw)
}
}
//after rendering within a routed context, we need to scroll back to the top, and fetch the document title for history.pushState
@ -640,6 +640,7 @@ var m = (function app(window, undefined) {
}
//m.route(route, params)
else if (type.call(arguments[0]) === STRING) {
var oldRoute = currentRoute;
currentRoute = arguments[0];
var args = arguments[1] || {}
var queryIndex = currentRoute.indexOf("?")
@ -649,7 +650,7 @@ var m = (function app(window, undefined) {
var currentPath = queryIndex > -1 ? currentRoute.slice(0, queryIndex) : currentRoute
if (querystring) currentRoute = currentPath + (currentPath.indexOf("?") === -1 ? "?" : "&") + querystring;
var shouldReplaceHistoryEntry = (arguments.length === 3 ? arguments[2] : arguments[1]) === true || currentRoute === arguments[0];
var shouldReplaceHistoryEntry = (arguments.length === 3 ? arguments[2] : arguments[1]) === true || oldRoute === arguments[0];
if (window.history.pushState) {
computePostRedrawHook = function() {
@ -718,7 +719,7 @@ var m = (function app(window, undefined) {
var pair = value != null && (valueType === OBJECT) ?
buildQueryString(value, key) :
valueType === ARRAY ?
value.map(function(item) {return encodeURIComponent(key) + "=" + encodeURIComponent(item)}).join("&") :
value.map(function(item) {return encodeURIComponent(key + "[]") + "=" + encodeURIComponent(item)}).join("&") :
encodeURIComponent(key) + "=" + encodeURIComponent(value)
str.push(pair)
}