Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/twbs/bootstrap.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacob Thornton <jacobthornton@gmail.com>2012-06-03 06:31:30 +0400
committerJacob Thornton <jacobthornton@gmail.com>2012-06-03 06:31:30 +0400
commit0b827965d36f87feddcee1ecb3f6e2f9c6dec9dc (patch)
treed748a162751b689e79d4679d648ba0d6e29a8e4a /docs/assets/js/bootstrap-typeahead.js
parent354f99f0bd8e1c2dcf9e094245b71e2587bd78c1 (diff)
fix regression in typeahead #3313
Diffstat (limited to 'docs/assets/js/bootstrap-typeahead.js')
-rw-r--r--docs/assets/js/bootstrap-typeahead.js60
1 files changed, 33 insertions, 27 deletions
diff --git a/docs/assets/js/bootstrap-typeahead.js b/docs/assets/js/bootstrap-typeahead.js
index ad44b90852..6300ff78f8 100644
--- a/docs/assets/js/bootstrap-typeahead.js
+++ b/docs/assets/js/bootstrap-typeahead.js
@@ -169,7 +169,7 @@
.on('keyup', $.proxy(this.keyup, this))
if ($.browser.webkit || $.browser.msie) {
- this.$element.on('keydown', $.proxy(this.keypress, this))
+ this.$element.on('keydown', $.proxy(this.keydown, this))
}
this.$menu
@@ -177,6 +177,38 @@
.on('mouseenter', 'li', $.proxy(this.mouseenter, this))
}
+ , move: function (e) {
+ switch(e.keyCode) {
+ case 9: // tab
+ case 13: // enter
+ case 27: // escape
+ e.preventDefault()
+ break
+
+ case 38: // up arrow
+ e.preventDefault()
+ this.prev()
+ break
+
+ case 40: // down arrow
+ e.preventDefault()
+ this.next()
+ break
+ }
+
+ e.stopPropagation()
+ }
+
+ , keydown: function (e) {
+ this.suppressKeyPressRepeat = !~[40,38,9,13,27].indexOf(e.keyCode)
+ this.move(e)
+ }
+
+ , keypress: function (e) {
+ if (!this.shown || this.suppressKeyPressRepeat) return
+ this.move(e)
+ }
+
, keyup: function (e) {
switch(e.keyCode) {
case 40: // down arrow
@@ -202,32 +234,6 @@
e.preventDefault()
}
- , keypress: function (e) {
- if (!this.shown) return
-
- switch(e.keyCode) {
- case 9: // tab
- case 13: // enter
- case 27: // escape
- e.preventDefault()
- break
-
- case 38: // up arrow
- if (e.type != 'keydown') break
- e.preventDefault()
- this.prev()
- break
-
- case 40: // down arrow
- if (e.type != 'keydown') break
- e.preventDefault()
- this.next()
- break
- }
-
- e.stopPropagation()
- }
-
, blur: function (e) {
var that = this
setTimeout(function () { that.hide() }, 150)