Run unload method before pushing the new state

If running unload causes any hash changes, those should
not end up on the new URL.

Fixes #622
This commit is contained in:
John Firebaugh 2013-12-05 12:11:57 -08:00 committed by Tom Hughes
parent 21407ede7e
commit 69aca22e6a

View file

@ -113,8 +113,8 @@ OSM.Router = function(map, rts) {
var path = url.replace(/#.*/, ''),
route = routes.recognize(path);
if (!route) return false;
window.history.pushState(OSM.parseHash(url), document.title, url);
currentRoute.run('unload');
window.history.pushState(OSM.parseHash(url), document.title, url);
currentPath = path;
currentRoute = route;
currentRoute.run('pushstate', currentPath);