From ba20843e072057f69c87b89f9f2aea7d46cf8367 Mon Sep 17 00:00:00 2001 From: gorhill Date: Sun, 25 Oct 2015 09:38:48 -0400 Subject: [PATCH] this fixes bad sorting of hostnames on Pale Moon --- src/js/popup.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/js/popup.js b/src/js/popup.js index cbba06b0d..ce777e65e 100644 --- a/src/js/popup.js +++ b/src/js/popup.js @@ -181,11 +181,16 @@ var formatNumber = function(count) { var rulekeyCompare = function(a, b) { var ha = a.slice(2, a.indexOf(' ', 2)); if ( !reIP.test(ha) ) { - ha = hostnameToSortableTokenMap[ha] || ''; + ha = hostnameToSortableTokenMap[ha] || ' '; } var hb = b.slice(2, b.indexOf(' ', 2)); if ( !reIP.test(hb) ) { - hb = hostnameToSortableTokenMap[hb] || ''; + hb = hostnameToSortableTokenMap[hb] || ' '; + } + var ca = ha.charCodeAt(0), + cb = hb.charCodeAt(0); + if ( ca !== cb ) { + return ca - cb; } return ha.localeCompare(hb); };