From 2b7d7ebfbf92ce224ad7665951071076da80930e Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Fri, 15 Mar 2013 17:40:59 -0400 Subject: [PATCH] Don't rely on object property order to sort tags It works, but in theory it's not guaranteed in JS. --- .../content/zotero/bindings/tagselector.xml | 22 ++++++++++++++----- chrome/content/zotero/xpcom/data/tags.js | 5 ----- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/chrome/content/zotero/bindings/tagselector.xml b/chrome/content/zotero/bindings/tagselector.xml index 65cfae7005..b2af3340fe 100644 --- a/chrome/content/zotero/bindings/tagselector.xml +++ b/chrome/content/zotero/bindings/tagselector.xml @@ -226,9 +226,19 @@ // Remove children tagsToggleBox.textContent = ""; - var lastTag; + // Sort by name + var orderedTags = []; + var collation = Zotero.getLocaleCollation(); for (let tagID in self._tags) { - let tagButton = self._makeClickableTag(tagID, lastTag, self.editable); + orderedTags.push(self._tags[tagID]) + } + orderedTags.sort(function(a, b) { + return collation.compareString(1, a.name, b.name); + }); + + var lastTag; + for (let i=0; i - +