diff options
Diffstat (limited to 'js/bootstrap-typeahead.js')
| -rw-r--r-- | js/bootstrap-typeahead.js | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/js/bootstrap-typeahead.js b/js/bootstrap-typeahead.js index d079da3a7..78cbe9faa 100644 --- a/js/bootstrap-typeahead.js +++ b/js/bootstrap-typeahead.js @@ -174,7 +174,7 @@ .on('keypress', $.proxy(this.keypress, this)) .on('keyup', $.proxy(this.keyup, this)) - if ($.browser.chrome || $.browser.webkit || $.browser.msie) { + if (this.eventSupported('keydown')) { this.$element.on('keydown', $.proxy(this.keydown, this)) } @@ -183,6 +183,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 |
