]> git.ipfire.org Git - thirdparty/bootstrap.git/commitdiff
Collapse.js preventDefault if `[data-toggle="collapse"]` is an anchor tag
authorPatrick Yeo <patrick.yeo@liferay.com>
Fri, 8 Sep 2017 21:53:15 +0000 (14:53 -0700)
committerPatrick Yeo <patrick.yeo@liferay.com>
Fri, 8 Sep 2017 21:53:15 +0000 (14:53 -0700)
js/src/collapse.js

index acc959d40c8350792bbbac8fd059d5ebb7aa8f4d..bf9c990ecc9428343ea22ee6550fbf30dc911c55 100644 (file)
@@ -363,7 +363,7 @@ const Collapse = (() => {
 
   $(document).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE, function (event) {
     // preventDefault only for <a> elements (which change the URL) not inside the collapsible element
-    if (event.target.tagName === 'A' && !$.contains(this, event.target)) {
+    if (event.currentTarget.tagName === 'A') {
       event.preventDefault()
     }