aboutsummaryrefslogtreecommitdiff
path: root/js/bootstrap-typeahead.js
diff options
context:
space:
mode:
authorJacob Thornton <[email protected]>2012-09-20 16:23:54 -0700
committerJacob Thornton <[email protected]>2012-09-20 16:23:54 -0700
commit667179f406ea66fbe2d688bb132eaa0c0f7383a6 (patch)
treef0929e4039dc88c64b91ba11c3dd318e966b4a7c /js/bootstrap-typeahead.js
parentc92a75999f8b82c1a6fc997eca1cc0206c4c3bf1 (diff)
downloadbootstrap-667179f406ea66fbe2d688bb132eaa0c0f7383a6.tar.xz
bootstrap-667179f406ea66fbe2d688bb132eaa0c0f7383a6.zip
added support for jquery 1.8.*
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