Unconditionally unbind moveend event
authorJohn Firebaugh <john.firebaugh@gmail.com>
Tue, 3 Dec 2013 23:04:24 +0000 (15:04 -0800)
committerTom Hughes <tom@compton.nu>
Wed, 4 Dec 2013 00:31:20 +0000 (00:31 +0000)
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.

app/assets/javascripts/index/history.js

index dfec793f6494c6cf219f1b0c2bd8bf1526134913..d98179d8ad03bdd0e14509688a8d38d6a75d19f2 100644 (file)
@@ -134,10 +134,7 @@ OSM.History = function(map) {
 
   page.unload = function() {
     map.removeLayer(group);
 
   page.unload = function() {
     map.removeLayer(group);
-
-    if (window.location.pathname === '/history') {
-      map.off("moveend", update)
-    }
+    map.off("moveend", update);
 
     $("#history_tab").removeClass("current");
   };
 
     $("#history_tab").removeClass("current");
   };