2
0
mirror of https://github.com/tenrok/bootstrap.git synced 2026-05-30 15:24:08 +03:00

Collapse - preventDefault only on <a> elements not inside the collapsible

element
This commit is contained in:
Johann-S
2017-08-25 10:14:18 +02:00
parent 4571ab0e57
commit 5a90b4aa3e
3 changed files with 28 additions and 2 deletions
+2 -1
View File
@@ -361,7 +361,8 @@ const Collapse = (($) => {
*/
$(document).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE, function (event) {
if (!/input|textarea/i.test(event.target.tagName)) {
// preventDefault only for <a> elements (which change the URL) not inside the collapsible element
if (event.target.tagName === 'A' && !$.contains(this, event.target)) {
event.preventDefault()
}