Bug 1480057 - fix sorting of chat participants list by accessing label/name correctly after switch to richlistbox. r=mkmelin
authorFlorian Quèze <florian@queze.net>
Sun, 06 Jan 2019 20:59:52 +0100
changeset 33282 3df2a9ba3c39
parent 33281 b5994bd3ba76
child 33283 b5746afc4831
push id2368
push userclokep@gmail.com
push dateMon, 28 Jan 2019 21:12:50 +0000
treeherdercomm-beta@56d23c07d815 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmkmelin
bugs1480057
Bug 1480057 - fix sorting of chat participants list by accessing label/name correctly after switch to richlistbox. r=mkmelin
mail/components/im/content/imconversation.xml
--- a/mail/components/im/content/imconversation.xml
+++ b/mail/components/im/content/imconversation.xml
@@ -1123,25 +1123,24 @@
        </body>
      </method>
 
      <method name="addNick">
        <parameter name="aListItem"/>
        <body>
        <![CDATA[
          var nicklist = document.getElementById("nicklist");
-         var nick = aListItem.getAttribute("label").toLowerCase();
+         var nick = aListItem.querySelector("label").value.toLowerCase();
 
          // Look for the place of the nick in the list
          var start = 0;
          var end = nicklist.itemCount;
          while (start < end) {
            var middle = start + Math.floor((end - start) / 2);
-           if (nick < nicklist.getItemAtIndex(middle)
-                              .getAttribute("label").toLowerCase())
+           if (nick < nicklist.getItemAtIndex(middle).label.toLowerCase())
              end = middle;
            else
              start = middle + 1;
          }
 
          // Now insert the element
          if (end == nicklist.itemCount)
            nicklist.appendChild(aListItem);
@@ -1185,17 +1184,17 @@
 
          if (this.buddies.has(name))
            throw "Updating a chat buddy to an already existing one: " + name;
 
          let item = this.buddies.get(aOldName);
          item.chatBuddy = aBuddy;
          this.buddies.delete(aOldName);
          this.buddies.set(name, item);
-         item.setAttribute("label", name);
+         item.querySelector("label").value = name;
 
          // Move this item to the right position if its name changed
          item.remove();
          this.addNick(item);
        ]]>
        </body>
      </method>