mirror of
https://github.com/zulip/zulip.git
synced 2025-11-03 13:33:24 +00:00
typeahead: Use ?? instead of ||.
This commit is contained in:
@@ -152,26 +152,26 @@ import {get_string_diff} from "../../src/util";
|
|||||||
const Typeahead = function (element, options) {
|
const Typeahead = function (element, options) {
|
||||||
this.$element = $(element);
|
this.$element = $(element);
|
||||||
this.options = $.extend({}, $.fn.typeahead.defaults, options);
|
this.options = $.extend({}, $.fn.typeahead.defaults, options);
|
||||||
this.matcher = this.options.matcher || this.matcher;
|
this.matcher = this.options.matcher ?? this.matcher;
|
||||||
this.sorter = this.options.sorter || this.sorter;
|
this.sorter = this.options.sorter ?? this.sorter;
|
||||||
this.highlighter = this.options.highlighter;
|
this.highlighter = this.options.highlighter;
|
||||||
this.updater = this.options.updater || this.updater;
|
this.updater = this.options.updater ?? this.updater;
|
||||||
this.$container = $(this.options.container).appendTo(this.options.parentElement || "body");
|
this.$container = $(this.options.container).appendTo(this.options.parentElement ?? "body");
|
||||||
this.$menu = $(this.options.menu).appendTo(this.$container);
|
this.$menu = $(this.options.menu).appendTo(this.$container);
|
||||||
this.$header = $(this.options.header_html).appendTo(this.$container);
|
this.$header = $(this.options.header_html).appendTo(this.$container);
|
||||||
this.source = this.options.source;
|
this.source = this.options.source;
|
||||||
this.shown = false;
|
this.shown = false;
|
||||||
this.mouse_moved_since_typeahead = false;
|
this.mouse_moved_since_typeahead = false;
|
||||||
this.dropup = this.options.dropup;
|
this.dropup = this.options.dropup;
|
||||||
this.fixed = this.options.fixed || false;
|
this.fixed = this.options.fixed ?? false;
|
||||||
this.automated = this.options.automated || (() => false);
|
this.automated = this.options.automated ?? (() => false);
|
||||||
this.trigger_selection = this.options.trigger_selection || (() => false);
|
this.trigger_selection = this.options.trigger_selection ?? (() => false);
|
||||||
this.on_move = this.options.on_move;
|
this.on_move = this.options.on_move;
|
||||||
this.on_escape = this.options.on_escape;
|
this.on_escape = this.options.on_escape;
|
||||||
// return a string to show in typeahead header or false.
|
// return a string to show in typeahead header or false.
|
||||||
this.header = this.options.header || (() => false);
|
this.header = this.options.header ?? (() => false);
|
||||||
// return a string to show in typeahead items or false.
|
// return a string to show in typeahead items or false.
|
||||||
this.option_label = this.options.option_label || (() => false);
|
this.option_label = this.options.option_label ?? (() => false);
|
||||||
|
|
||||||
if (this.fixed) {
|
if (this.fixed) {
|
||||||
this.$container.css("position", "fixed");
|
this.$container.css("position", "fixed");
|
||||||
|
|||||||
Reference in New Issue
Block a user