mirror of https://github.com/zulip/zulip.git
Use feature detection for bootstrap typeahead key handling
(imported from commit 1ce443d3e61920bf5842b31263141d4f175a6514)
This commit is contained in:
parent
2530009123
commit
eaa777b612
|
@ -2002,7 +2002,7 @@
|
|||
.on('keypress', $.proxy(this.keypress, this))
|
||||
.on('keyup', $.proxy(this.keyup, this))
|
||||
|
||||
if ($.browser.webkit || $.browser.msie) {
|
||||
if (this.eventSupported('keydown')) {
|
||||
this.$element.on('keydown', $.proxy(this.keydown, this))
|
||||
}
|
||||
|
||||
|
@ -2011,6 +2011,15 @@
|
|||
.on('mouseenter', 'li', $.proxy(this.mouseenter, this))
|
||||
}
|
||||
|
||||
, eventSupported: function(eventName) {
|
||||
var isSupported = eventName in this.$element
|
||||
if (!isSupported) {
|
||||
this.$element.setAttribute(eventName, 'return;')
|
||||
isSupported = typeof this.$element[eventName] === 'function'
|
||||
}
|
||||
return isSupported
|
||||
}
|
||||
|
||||
, move: function (e) {
|
||||
if (!this.shown) return
|
||||
|
||||
|
|
Loading…
Reference in New Issue