diff --git a/js/bootstrap-dropdown.js b/js/bootstrap-dropdown.js index bd97356d1802..d00c541eeb4b 100644 --- a/js/bootstrap-dropdown.js +++ b/js/bootstrap-dropdown.js @@ -142,9 +142,9 @@ $('html') .on('click.dropdown.data-api touchstart.dropdown.data-api', clearMenus) $('body') - .on('click.dropdown touchstart.dropdown.data-api', '.dropdown', function (e) { e.stopPropagation() }) + .on('click.dropdown touchstart.dropdown.data-api', '.dropdown form', 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 +}(window.jQuery); diff --git a/js/tests/unit/bootstrap-dropdown.js b/js/tests/unit/bootstrap-dropdown.js index 4e52c8485e71..0851c319fc8b 100644 --- a/js/tests/unit/bootstrap-dropdown.js +++ b/js/tests/unit/bootstrap-dropdown.js @@ -84,4 +84,28 @@ $(function () { dropdown.remove() }) -}) \ No newline at end of file + test("should collapse after link clicked", function () { + var dropdownHTML = '