diff --git a/js/bootstrap-dropdown.js b/js/bootstrap-dropdown.js index f27f4d2f43..411c2f7bfd 100644 --- a/js/bootstrap-dropdown.js +++ b/js/bootstrap-dropdown.js @@ -40,10 +40,14 @@ , toggle: function (e) { var $this = $(this) - , selector = $this.attr('data-target') + , selector , $parent , isActive + if ($this.is('.disabled, :disabled')) return + + selector = $this.attr('data-target') + if (!selector) { selector = $this.attr('href') selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7 diff --git a/js/tests/unit/bootstrap-dropdown.js b/js/tests/unit/bootstrap-dropdown.js index 368ced2a5a..4e52c8485e 100644 --- a/js/tests/unit/bootstrap-dropdown.js +++ b/js/tests/unit/bootstrap-dropdown.js @@ -10,6 +10,40 @@ $(function () { ok($(document.body).dropdown()[0] == document.body, 'document.body returned') }) + test("should not open dropdown if target is disabled", function () { + var dropdownHTML = '