diff options
| author | Mark Otto <[email protected]> | 2012-09-22 21:37:08 -0700 |
|---|---|---|
| committer | Mark Otto <[email protected]> | 2012-09-22 21:37:08 -0700 |
| commit | c3ea955661568b9b05075e62c0b5d2e8bf7ef10c (patch) | |
| tree | 73e069a0fbd69e7b5764da3f18008d185859c520 /js/bootstrap-typeahead.js | |
| parent | a419e70a42f7f4c8165e640774082d3fec61b4c4 (diff) | |
| parent | ebf94c53a5497ff6d2aa353027d3a2ac3b67b18a (diff) | |
| download | bootstrap-c3ea955661568b9b05075e62c0b5d2e8bf7ef10c.tar.xz bootstrap-c3ea955661568b9b05075e62c0b5d2e8bf7ef10c.zip | |
Merge branch '2.1.2-wip' of github.com:twitter/bootstrap into 2.1.2-wip
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 |
