diff roster.js @ 34:45bd945c5722

Change all blur events to change, prevents a stanza when no change occured.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Sun, 23 Dec 2018 20:31:02 +0100
parents 5e97e1808a35
children c2e2b107c7c1
line wrap: on
line diff
--- a/roster.js
+++ b/roster.js
@@ -28,14 +28,14 @@ function initRoster(connection) {
             td = document.createElementNS('http://www.w3.org/1999/xhtml', 'td');
             const input = document.createElementNS('http://www.w3.org/1999/xhtml', 'input');
             input.value = name;
-            input.onblur = function (evt) {
+            input.addEventListener('change', function (evt) {
                 const iq = $iq({type: 'set'})
                     .c('query', {xmlns: NS.roster})
                         .c('item', {jid: jid, name: evt.target.value});
                 for (let group of groups)
                     iq.c('group').t(group.textContent).up();
                 connection.sendIQ(iq, onRosterSet, onRosterSetError.bind(null, 'Roster set failed.'));
-            };
+            });
             td.appendChild(input);
             tr.appendChild(td);
             td = document.createElementNS('http://www.w3.org/1999/xhtml', 'td');