Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

typeahead: Clean up render function.

evykassirer3f5be23854a3
diff --git a/web/src/bootstrap_typeahead.js b/web/src/bootstrap_typeahead.js
index 46f4511fd4e..252d55109d4 100644
--- a/web/src/bootstrap_typeahead.js
+++ b/web/src/bootstrap_typeahead.js
@@ -350,7 +350,7 @@ Typeahead.prototype = {
},
render(final_items, matching_items) {
- const $items = $(final_items).map((_index, item) => {
+ const $items = final_items.map((item) => {
const $i = $(ITEM_HTML).data("typeahead-value", item);
const item_html = this.highlighter_html(item);
const $item_html = $i.find("a").html(item_html);
@@ -360,10 +360,10 @@ Typeahead.prototype = {
if (option_label_html) {
$item_html.append(option_label_html).addClass("typeahead-option-label");
}
- return $i[0];
+ return $i;
});
- $items.first().addClass("active");
+ $items[0].addClass("active");
this.$menu.empty().append($items);
return this;
},