From d5ad910d57d0f352ffe577663e394ad5a41c5b14 Mon Sep 17 00:00:00 2001 From: Thomas Tanghus Date: Thu, 23 May 2013 03:46:09 +0200 Subject: [PATCH] Made sorting 10 times faster --- js/contacts.js | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/js/contacts.js b/js/contacts.js index 1a40bf6a..a434337a 100644 --- a/js/contacts.js +++ b/js/contacts.js @@ -2242,23 +2242,13 @@ OC.Contacts = OC.Contacts || {}; //var rows = this.$contactList.find('tr:visible.contact').get(); rows.sort(function(a, b) { - return $(a).find('.nametext').text().toUpperCase().localeCompare($(b).find('td.name').text().toUpperCase()); + // 10 (TEN!) times faster than using jQuery! + return a.firstElementChild.textContent.trim().toUpperCase().localeCompare(b.firstElementChild.textContent.trim().toUpperCase()); + //return $(a).find('.nametext').text().toUpperCase().localeCompare($(b).find('td.name').text().toUpperCase()); }); - // NOTE: This is slightly faster than using batches in Chrome, but I'm not sure how IE etc. deals with it. self.$contactList.prepend(rows); - /*var items = []; - $.each(rows, function(index, row) { - items.push(row); - if(items.length === 100) { - self.$contactList.append(items); - items = []; - } - }); - if(items.length > 0) { - self.$contactList.append(items); - }*/ }; /**