From 09fd3a4d5f78ba5bd2769a48981c7bd90842280b Mon Sep 17 00:00:00 2001 From: Anton Sarukhanov <code@ant.sr> Date: Wed, 4 May 2016 15:17:53 -0400 Subject: [PATCH] Fix stops alpha-sort for cross-browser support. --- static/js/embed.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/static/js/embed.js b/static/js/embed.js index a199b57..28d23a0 100644 --- a/static/js/embed.js +++ b/static/js/embed.js @@ -22,7 +22,11 @@ BusMap.Embed = function(opts) { var populateOptions = function() { var stops = window._busmap.stops; stops = Object.keys(stops).map(function(i){return stops[i]}); - stops.sort(function(a,b){ return a.title > b.title; }); + stops = stops.sort(function(a,b){ + if (a.title > b.title) return 1; + else if (a.title < b.title) return -1; + return 0; + }); for (id in stops) { var s = stops[id]; var opt = $('<option value="' + s.id + '">' + s.title + '</option>'); -- GitLab