vendor/assets/javascripts/twitter/bootstrap/bootstrap-dropdown.js in twitter-bootstrap-rails-2.1.7 vs vendor/assets/javascripts/twitter/bootstrap/bootstrap-dropdown.js in twitter-bootstrap-rails-2.1.8
- old
+ new
@@ -1,7 +1,7 @@
/* ============================================================
- * bootstrap-dropdown.js v2.2.1
+ * bootstrap-dropdown.js v2.2.2
* http://twitter.github.com/bootstrap/javascript.html#dropdowns
* ============================================================
* Copyright 2012 Twitter, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -51,13 +51,14 @@
clearMenus()
if (!isActive) {
$parent.toggleClass('open')
- $this.focus()
}
+ $this.focus()
+
return false
}
, keydown: function (e) {
var $this
@@ -80,11 +81,11 @@
isActive = $parent.hasClass('open')
if (!isActive || (isActive && e.keyCode == 27)) return $this.click()
- $items = $('[role=menu] li:not(.divider) a', $parent)
+ $items = $('[role=menu] li:not(.divider):visible a', $parent)
if (!$items.length) return
index = $items.index($items.filter(':focus'))
@@ -122,10 +123,12 @@
/* DROPDOWN PLUGIN DEFINITION
* ========================== */
+ var old = $.fn.dropdown
+
$.fn.dropdown = function (option) {
return this.each(function () {
var $this = $(this)
, data = $this.data('dropdown')
if (!data) $this.data('dropdown', (data = new Dropdown(this)))
@@ -134,15 +137,25 @@
}
$.fn.dropdown.Constructor = Dropdown
+ /* DROPDOWN NO CONFLICT
+ * ==================== */
+
+ $.fn.dropdown.noConflict = function () {
+ $.fn.dropdown = old
+ return this
+ }
+
+
/* APPLY TO STANDARD DROPDOWN ELEMENTS
* =================================== */
$(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)
}(window.jQuery);
\ No newline at end of file