Panel and modal close bindings should refer the target element in the event, not $(this)

This commit is contained in:
Fabio Manganiello 2019-02-21 20:13:31 +01:00
parent 749436c452
commit 73383ab80f

View file

@ -173,7 +173,7 @@ $(document).ready(function() {
}); });
$('body').on('mouseup touchend', function(event) { $('body').on('mouseup touchend', function(event) {
var $source = $(this); var $source = $(event.target);
if (!$source.parents('.modal').length if (!$source.parents('.modal').length
&& !$source.data('modal') && !$source.data('modal')
&& !$source.data('dismiss-modal')) { && !$source.data('dismiss-modal')) {
@ -196,7 +196,7 @@ $(document).ready(function() {
var initPanelCloseBindings = function() { var initPanelCloseBindings = function() {
$('body').on('mouseup touchend', function(event) { $('body').on('mouseup touchend', function(event) {
var $source = $(this); var $source = $(event.target);
if ($source.data('panel') || $source.parents('[data-panel]').length) { if ($source.data('panel') || $source.parents('[data-panel]').length) {
var $panel = $source.data('panel') ? $($source.data('panel')) : var $panel = $source.data('panel') ? $($source.data('panel')) :
$($source.parents('[data-panel]').data('panel')); $($source.parents('[data-panel]').data('panel'));