diff options
author | fat <jacobthornton@gmail.com> | 2013-02-08 10:13:13 +0400 |
---|---|---|
committer | fat <jacobthornton@gmail.com> | 2013-02-08 10:13:13 +0400 |
commit | 8c7f9c66a7d12f47f50618ef420868fe836d0c33 (patch) | |
tree | 552f251d1637a1749c34fcdbb3390653d2fdb8ae /js/bootstrap-dropdown.js | |
parent | ee91afba63bc6e9687397b9052858fca242c2ff5 (diff) | |
parent | c4d47fb1ea45ed2fc3cf382d087ed87b87c69288 (diff) |
Merge branch '2.3.0-wip'v2.3.0
Diffstat (limited to 'js/bootstrap-dropdown.js')
-rw-r--r-- | js/bootstrap-dropdown.js | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/js/bootstrap-dropdown.js b/js/bootstrap-dropdown.js index 900355d5bd..ec86cf0d70 100644 --- a/js/bootstrap-dropdown.js +++ b/js/bootstrap-dropdown.js @@ -1,5 +1,5 @@ /* ============================================================ - * bootstrap-dropdown.js v2.2.2 + * bootstrap-dropdown.js v2.3.0 * http://twitter.github.com/bootstrap/javascript.html#dropdowns * ============================================================ * Copyright 2012 Twitter, Inc. @@ -81,7 +81,10 @@ isActive = $parent.hasClass('open') - if (!isActive || (isActive && e.keyCode == 27)) return $this.click() + if (!isActive || (isActive && e.keyCode == 27)) { + if (e.which == 27) $parent.find(toggle).focus() + return $this.click() + } $items = $('[role=menu] li:not(.divider):visible a', $parent) @@ -115,8 +118,9 @@ selector = selector && /#/.test(selector) && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7 } - $parent = $(selector) - $parent.length || ($parent = $this.parent()) + $parent = selector && $(selector) + + if (!$parent || !$parent.length) $parent = $this.parent() return $parent } @@ -152,10 +156,10 @@ * =================================== */ $(document) - .on('click.dropdown.data-api touchstart.dropdown.data-api', clearMenus) - .on('click.dropdown touchstart.dropdown.data-api', '.dropdown form', function (e) { e.stopPropagation() }) - .on('touchstart.dropdown.data-api', '.dropdown-menu', function (e) { e.stopPropagation() }) - .on('click.dropdown.data-api touchstart.dropdown.data-api' , toggle, Dropdown.prototype.toggle) - .on('keydown.dropdown.data-api touchstart.dropdown.data-api', toggle + ', [role=menu]' , Dropdown.prototype.keydown) + .on('click.dropdown.data-api', clearMenus) + .on('click.dropdown.data-api', '.dropdown form', function (e) { e.stopPropagation() }) + .on('.dropdown-menu', function (e) { e.stopPropagation() }) + .on('click.dropdown.data-api' , toggle, Dropdown.prototype.toggle) + .on('keydown.dropdown.data-api', toggle + ', [role=menu]' , Dropdown.prototype.keydown) -}(window.jQuery);
\ No newline at end of file +}(window.jQuery); |