mirror of https://github.com/zulip/zulip.git
typeahead: Clean up render function.
`final_items` is a list of `ItemType` so it doesn't make sense to wrap it in `$()`. Intead of creating a "jquery list of objects", we generate a list of JQuery objects. I also removed the unused `_index` in the `map` call.
This commit is contained in:
parent
6aee4f270e
commit
3f5be23854
|
@ -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;
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue