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:
authorMark Otto <otto@github.com>2012-12-20 12:02:52 +0400
committerMark Otto <otto@github.com>2012-12-20 12:02:52 +0400
commit72f13e2870c431f132b9f63cc9d7e87bc6810425 (patch)
treeca5e4d8cbbcd3f3ef57ac04fad009d39fbf7b89a /js/bootstrap-typeahead.js
parent14844db862a61c92be982921e14a526484f3b8a9 (diff)
parent9726fded1c587c14b57a61a92b88ac74fe21d320 (diff)
Merge branch '2.2.3' into 3.0.0-wip
Conflicts: Makefile README.md component.json docs/assets/css/bootstrap-responsive.css docs/assets/css/bootstrap.css docs/assets/js/bootstrap-affix.js docs/assets/js/bootstrap-alert.js docs/assets/js/bootstrap-button.js docs/assets/js/bootstrap-carousel.js docs/assets/js/bootstrap-collapse.js docs/assets/js/bootstrap-dropdown.js docs/assets/js/bootstrap-modal.js docs/assets/js/bootstrap-popover.js docs/assets/js/bootstrap-scrollspy.js docs/assets/js/bootstrap-tab.js docs/assets/js/bootstrap-tooltip.js docs/assets/js/bootstrap-transition.js docs/assets/js/bootstrap-typeahead.js docs/assets/js/bootstrap.js docs/assets/js/bootstrap.min.js docs/index.html docs/templates/pages/base-css.mustache docs/templates/pages/index.mustache docs/templates/pages/javascript.mustache js/bootstrap-affix.js js/bootstrap-alert.js js/bootstrap-button.js js/bootstrap-carousel.js js/bootstrap-collapse.js js/bootstrap-dropdown.js js/bootstrap-modal.js js/bootstrap-popover.js js/bootstrap-scrollspy.js js/bootstrap-tab.js js/bootstrap-tooltip.js js/bootstrap-transition.js js/bootstrap-typeahead.js less/bootstrap.less less/responsive.less less/type.less package.json
Diffstat (limited to 'js/bootstrap-typeahead.js')
-rw-r--r--js/bootstrap-typeahead.js16
1 files changed, 14 insertions, 2 deletions
diff --git a/js/bootstrap-typeahead.js b/js/bootstrap-typeahead.js
index 94101db05a..609be260cc 100644
--- a/js/bootstrap-typeahead.js
+++ b/js/bootstrap-typeahead.js
@@ -172,6 +172,7 @@
, listen: function () {
this.$element
+ .on('focus', $.proxy(this.focus, this))
.on('blur', $.proxy(this.blur, this))
.on('keypress', $.proxy(this.keypress, this))
.on('keyup', $.proxy(this.keyup, this))
@@ -183,6 +184,7 @@
this.$menu
.on('click', $.proxy(this.click, this))
.on('mouseenter', 'li', $.proxy(this.mouseenter, this))
+ .on('mouseleave', 'li', $.proxy(this.mouseleave, this))
}
, eventSupported: function(eventName) {
@@ -256,9 +258,13 @@
e.preventDefault()
}
+ , focus: function (e) {
+ this.focused = true
+ }
+
, blur: function (e) {
- var that = this
- setTimeout(function () { that.hide() }, 150)
+ this.focused = false
+ if (!this.mousedover && this.shown) this.hide()
}
, click: function (e) {
@@ -268,10 +274,16 @@
}
, mouseenter: function (e) {
+ this.mousedover = true
this.$menu.find('.active').removeClass('active')
$(e.currentTarget).addClass('active')
}
+ , mouseleave: function (e) {
+ this.mousedover = false
+ if (!this.focused && this.shown) this.hide()
+ }
+
}