diff --git a/Makefile b/Makefile index 8f57099b..a0ad78d6 100644 --- a/Makefile +++ b/Makefile @@ -2,8 +2,6 @@ BOOTSTRAP = ./docs/assets/css/bootstrap.css BOOTSTRAP_LESS = ./less/bootstrap.less BOOTSTRAP_RESPONSIVE = ./docs/assets/css/bootstrap-responsive.css BOOTSTRAP_RESPONSIVE_LESS = ./less/responsive.less -LESS_COMPRESSOR ?= `which lessc` -WATCHR ?= `which watchr` # # BUILD DOCS diff --git a/docs/assets/bootstrap.zip b/docs/assets/bootstrap.zip index 4aae825c..4e3217a7 100644 Binary files a/docs/assets/bootstrap.zip and b/docs/assets/bootstrap.zip differ diff --git a/docs/assets/js/bootstrap-dropdown.js b/docs/assets/js/bootstrap-dropdown.js index f27f4d2f..d856ba6e 100644 --- a/docs/assets/js/bootstrap-dropdown.js +++ b/docs/assets/js/bootstrap-dropdown.js @@ -40,10 +40,14 @@ , toggle: function (e) { var $this = $(this) - , selector = $this.attr('data-target') , $parent + , selector , 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/bootstrap-dropdown.js b/js/bootstrap-dropdown.js index f27f4d2f..d856ba6e 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') , $parent + , selector , 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 368ced2a..4e52c848 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 = '' + , dropdown = $(dropdownHTML).find('[data-toggle="dropdown"]').dropdown().click() + + ok(!dropdown.parent('.dropdown').hasClass('open'), 'open class added on click') + }) + + test("should not open dropdown if target is disabled", function () { + var dropdownHTML = '' + , dropdown = $(dropdownHTML).find('[data-toggle="dropdown"]').dropdown().click() + + ok(!dropdown.parent('.dropdown').hasClass('open'), 'open class added on click') + }) + test("should add class open to menu if clicked", function () { var dropdownHTML = '