aboutsummaryrefslogtreecommitdiff
path: root/js/bootstrap-typeahead.js
diff options
context:
space:
mode:
authorMark Otto <[email protected]>2012-09-25 22:00:41 -0700
committerMark Otto <[email protected]>2012-09-25 22:00:41 -0700
commitce19e63d5b068ba0698dee4e2d99c725f6799b0d (patch)
treebda8377cdc83204780bdf624833725a127ded586 /js/bootstrap-typeahead.js
parent527d01ce99a0cae8eae7868c0649dca60cda338c (diff)
parentf4d3d7da2e3ddbd751e053729935df1f3dd4c051 (diff)
downloadbootstrap-ce19e63d5b068ba0698dee4e2d99c725f6799b0d.tar.xz
bootstrap-ce19e63d5b068ba0698dee4e2d99c725f6799b0d.zip
Merge branch '2.1.2-wip' into box-sizing-exercise
Conflicts: docs/assets/css/bootstrap-responsive.css docs/assets/css/bootstrap.css docs/base-css.html docs/templates/pages/base-css.mustache less/forms.less less/mixins.less
Diffstat (limited to 'js/bootstrap-typeahead.js')
-rw-r--r--js/bootstrap-typeahead.js11
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