Skip to content

Commit

Permalink
Bug 816063 - Fixing names comparission to sort in the same way backen…
Browse files Browse the repository at this point in the history
…d does r=arcturus
  • Loading branch information
albertopq committed Nov 30, 2012
1 parent 494364a commit c8d730b
Showing 1 changed file with 3 additions and 18 deletions.
21 changes: 3 additions & 18 deletions apps/communications/contacts/js/contacts_list.js
Expand Up @@ -447,7 +447,6 @@ contacts.List = (function() {
FB data on the mozContacts DB.
*/
var addToList = function addToList(contact, enrichedContact) {
var newLi;

var theContact = contact;

Expand All @@ -457,7 +456,7 @@ contacts.List = (function() {

var group = getGroupName(theContact);

var list = groupsList.querySelector('#contacts-list-' + group);
var list = document.getElementById('contacts-list-' + group);

addToGroup(theContact, list);

Expand Down Expand Up @@ -505,22 +504,8 @@ contacts.List = (function() {
var len = liElems.length;
for (var i = 0; i < len; i++) {
var liElem = liElems[i];
var familyName = liElem.querySelector('p > strong').textContent.trim();
var givenName = liElem.querySelector('p');

if (!orderByLastName) {
var aux = familyName;
familyName = givenName;
givenName = aux;
} else {
givenName = givenName.childNodes[0].nodeValue.trim();
}

var name = getStringToBeOrdered({
familyName: [familyName],
givenName: [givenName]
});
if (name >= cName) {
var name = liElem.querySelector('p').dataset.search;
if (name.localeCompare(cName) >= 0) {
newLi = renderContact(contact);
list.insertBefore(newLi, liElem);
break;
Expand Down

0 comments on commit c8d730b

Please sign in to comment.