mirror of https://github.com/zulip/zulip.git
typeahead: Replace various deprecated jQuery methods.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
parent
a2a5871088
commit
0f76e98963
|
@ -115,12 +115,12 @@
|
||||||
, select: function (e) {
|
, select: function (e) {
|
||||||
var val = this.$menu.find('.active').data('typeahead-value')
|
var val = this.$menu.find('.active').data('typeahead-value')
|
||||||
if (this.$element.is("[contenteditable]")) {
|
if (this.$element.is("[contenteditable]")) {
|
||||||
this.$element.html(this.updater(val, e)).change();
|
this.$element.html(this.updater(val, e)).trigger("change");
|
||||||
// Empty textContent after the change event handler
|
// Empty textContent after the change event handler
|
||||||
// converts the input text to html elements.
|
// converts the input text to html elements.
|
||||||
this.$element.html('');
|
this.$element.html('');
|
||||||
} else {
|
} else {
|
||||||
this.$element.val(this.updater(val, e)).change();
|
this.$element.val(this.updater(val, e)).trigger("change");
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.hide()
|
return this.hide()
|
||||||
|
@ -209,7 +209,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
items = $.isFunction(this.source) ? this.source(this.query, $.proxy(this.process, this)) : this.source
|
items = typeof this.source === "function" ? this.source(this.query, this.process.bind(this)) : this.source
|
||||||
|
|
||||||
if (!items && this.shown) this.hide();
|
if (!items && this.shown) this.hide();
|
||||||
return items ? this.process(items) : this
|
return items ? this.process(items) : this
|
||||||
|
@ -307,17 +307,17 @@
|
||||||
|
|
||||||
, listen: function () {
|
, listen: function () {
|
||||||
this.$element
|
this.$element
|
||||||
.on('blur', $.proxy(this.blur, this))
|
.on('blur', this.blur(this))
|
||||||
.on('keypress', $.proxy(this.keypress, this))
|
.on('keypress', this.keypress.bind(this))
|
||||||
.on('keyup', $.proxy(this.keyup, this))
|
.on('keyup', this.keyup.bind(this))
|
||||||
|
|
||||||
if (this.eventSupported('keydown')) {
|
if (this.eventSupported('keydown')) {
|
||||||
this.$element.on('keydown', $.proxy(this.keydown, this))
|
this.$element.on('keydown', this.keydown.bind(this))
|
||||||
}
|
}
|
||||||
|
|
||||||
this.$menu
|
this.$menu
|
||||||
.on('click', $.proxy(this.click, this))
|
.on('click', this.click.bind(this))
|
||||||
.on('mouseenter', 'li', $.proxy(this.mouseenter, this))
|
.on('mouseenter', 'li', this.mouseenter.bind(this))
|
||||||
}
|
}
|
||||||
|
|
||||||
, eventSupported: function(eventName) {
|
, eventSupported: function(eventName) {
|
||||||
|
|
Loading…
Reference in New Issue