1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-23 11:27:58 +01:00

Dont sort constants in objectToString (theyre better ordered by value than key)

This commit is contained in:
Kris Maglione
2008-11-01 19:29:25 +00:00
parent 6be68bad2c
commit 8c1c2ee76a

View File

@@ -329,6 +329,8 @@ const util = { //{{{
key = <span style="font-weight: bold;">{i}</span>; key = <span style="font-weight: bold;">{i}</span>;
if (!isNaN(i)) if (!isNaN(i))
i = parseInt(i); i = parseInt(i);
else if (/^[A-Z_]+$/.test(i))
i = "";
keys.push([i, <>{key}{noVal ? "" : <>:{value}</>}<br/>&#xa;</>]); keys.push([i, <>{key}{noVal ? "" : <>:{value}</>}<br/>&#xa;</>]);
} }
} }
@@ -338,7 +340,7 @@ const util = { //{{{
{ {
if (!isNaN(a[0]) && !isNaN(b[0])) if (!isNaN(a[0]) && !isNaN(b[0]))
return a[0] - b[0]; return a[0] - b[0];
return String.localeCompare(a, b); return String.localeCompare(a[0], b[0]);
} }
string += template.map(keys.sort(compare), function (f) f[1]); string += template.map(keys.sort(compare), function (f) f[1]);
return color ? string : [s for each (s in string)].join(""); return color ? string : [s for each (s in string)].join("");