From f3e45c37780b12a3fa96e7d4578f38a883cba9a0 Mon Sep 17 00:00:00 2001 From: Jacob Thornton Date: Fri, 24 May 2013 23:15:04 -0700 Subject: [PATCH] add show/shown hide/hidden events to dropdown + update dropdown links for testing + catch a few missed namespace things --- docs/assets/js/bootstrap.js | 36 +++++++++++------- docs/assets/js/bootstrap.min.js | 2 +- docs/javascript.html | 48 +++++++++++------------ js/carousel.js | 2 +- js/collapse.js | 2 +- js/dropdown.js | 30 ++++++++++----- js/scrollspy.js | 2 +- js/tests/unit/dropdown.js | 67 +++++++++++++++++++++++++++++++++ 8 files changed, 138 insertions(+), 51 deletions(-) diff --git a/docs/assets/js/bootstrap.js b/docs/assets/js/bootstrap.js index f19a123a4a..b2b4086726 100644 --- a/docs/assets/js/bootstrap.js +++ b/docs/assets/js/bootstrap.js @@ -433,7 +433,7 @@ // CAROUSEL DATA-API // ================= - $(document).on('click.carousel.data-api', '[data-slide], [data-slide-to]', function (e) { + $(document).on('click.bs.carousel.data-api', '[data-slide], [data-slide-to]', function (e) { var $this = $(this), href var $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7 var options = $.extend({}, $target.data(), $this.data()) @@ -590,7 +590,7 @@ // COLLAPSE DATA-API // ================= - $(document).on('click.collapse.data-api', '[data-toggle=collapse]', function (e) { + $(document).on('click.bs.collapse.data-api', '[data-toggle=collapse]', function (e) { var $this = $(this), href var target = $this.attr('data-target') || e.preventDefault() @@ -630,10 +630,7 @@ var backdrop = '.dropdown-backdrop' var toggle = '[data-toggle=dropdown]' var Dropdown = function (element) { - var $el = $(element).on('click.dropdown.data-api', this.toggle) - $('html').on('click.dropdown.data-api', function () { - $el.parent().removeClass('open') - }) + var $el = $(element).on('click.bs.dropdown', this.toggle) } Dropdown.prototype.toggle = function (e) { @@ -651,7 +648,14 @@ // if mobile we we use a backdrop because click events don't delegate $('