diff --git a/js/alert.js b/js/alert.js index 5389c32e99..10483899df 100644 --- a/js/alert.js +++ b/js/alert.js @@ -36,7 +36,7 @@ if (e) e.preventDefault() if (!$parent.length) { - $parent = $this.hasClass('alert') ? $this : $this.parent() + $parent = $this.closest('.alert') } $parent.trigger(e = $.Event('close.bs.alert')) diff --git a/js/tests/unit/alert.js b/js/tests/unit/alert.js index 52505c828d..bc4eed6765 100644 --- a/js/tests/unit/alert.js +++ b/js/tests/unit/alert.js @@ -30,7 +30,7 @@ $(function () { }) test('should fade element out on clicking .close', function () { - var alertHTML = '