From 1f74e2133652aaee6f6e5c87263675f8fc00d9a3 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Wed, 10 Feb 2021 00:02:59 +0100 Subject: [PATCH] luci-base: luci.js: fix sortedKeys() ordering Chrome does not properly sort arrays when the sort function returns boolean results, in contrast to Firefox which does. Fix the issue by returning a numerical result instead. Fixes: #4792 Signed-off-by: Jo-Philipp Wich (cherry picked from commit 3c166c25de535c5c5aeda1d40eba6c1756c412be) --- modules/luci-base/htdocs/luci-static/resources/luci.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/modules/luci-base/htdocs/luci-static/resources/luci.js b/modules/luci-base/htdocs/luci-static/resources/luci.js index 2ec96dd672..c0e8b15a56 100644 --- a/modules/luci-base/htdocs/luci-static/resources/luci.js +++ b/modules/luci-base/htdocs/luci-static/resources/luci.js @@ -2946,7 +2946,12 @@ }).filter(function(e) { return (e[1] != null); }).sort(function(a, b) { - return (a[1] > b[1]); + if (a[1] < b[1]) + return -1; + else if (a[1] > b[1]) + return 1; + else + return 0; }).map(function(e) { return e[0]; }); -- 2.30.2