From: John Firebaugh Date: Tue, 3 Dec 2013 23:04:24 +0000 (-0800) Subject: Unconditionally unbind moveend event X-Git-Tag: live~4562 X-Git-Url: https://git.openstreetmap.org/rails.git/commitdiff_plain/bdbc1d663d04075f45a87a4b78b0744a008d758c Unconditionally unbind moveend event Can't rely on checking location.pathname -- inside unload, it already contains the new path. Fortunately, checking is unnecessary. Fixes TypeError: Cannot call method 'split' of undefined. --- diff --git a/app/assets/javascripts/index/history.js b/app/assets/javascripts/index/history.js index dfec793f6..d98179d8a 100644 --- a/app/assets/javascripts/index/history.js +++ b/app/assets/javascripts/index/history.js @@ -134,10 +134,7 @@ OSM.History = function(map) { page.unload = function() { map.removeLayer(group); - - if (window.location.pathname === '/history') { - map.off("moveend", update) - } + map.off("moveend", update); $("#history_tab").removeClass("current"); };