Browse Source

Fix using search results (#266)

With 5ccf64a the generated search results were converted to a string
containing HTML and then back. This dropped all registered event
handlers, including the click handler.

To retain the current behavior of displaying the old search results
until the new ones are available a list of divs is now created and then
set. This retains all registered event handlers.

fixes #251
ServiusHack 9 months ago
parent
commit
cdd175ded1
1 changed files with 5 additions and 3 deletions
  1. 5
    3
      js/ui/password_picker/password_picker.js

+ 5
- 3
js/ui/password_picker/password_picker.js View File

@@ -370,7 +370,7 @@ $(document).ready(function () {
370 370
             if (result.length === 0 || !result) {
371 371
                 $('#searchResults').html(API.i18n.getMessage('no_credentials_found'));
372 372
             }
373
-            var html = '';
373
+            var divs = [];
374 374
             for (var i = 0; i < result.length; i++) {
375 375
                 var login = result[i];
376 376
                 var div = $('<div>', {class: 'account', text: login.label});
@@ -394,10 +394,12 @@ $(document).ready(function () {
394 394
                     };
395 395
                 })(login));
396 396
                 /* jshint ignore:end*/
397
-                html += $('<div />').html(div).html();
397
+                divs.push(div);
398 398
 
399 399
             }
400
-            picker.find('#searchResults').html(html);
400
+            var searchResults = picker.find('#searchResults');
401
+            searchResults.empty();
402
+            searchResults.append(divs);
401 403
         });
402 404
     }
403 405