Skip to content

Commit

Permalink
fix(popup): avoid detection of wrong existing popup
Browse files Browse the repository at this point in the history
When a popup was defined to get its content out of an existing DOM-Node it was in some situations wrongly reused on another, totally different popup because the popup-creation code was searching for existing nodes _before__checking for a specific domnode. That way a previously detached domnode from another popup was used by accident.
This PR switched priorities to always check for a specific defined DOM node in settings.popup before looking for an existing dom node next to the popup.
  • Loading branch information
lubber-de authored and Sean committed Nov 5, 2019
1 parent 60989a5 commit 4473b66
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/definitions/modules/popup.js
Original file line number Diff line number Diff line change
Expand Up @@ -286,18 +286,18 @@ $.fn.popup = function(parameters) {
}
settings.onCreate.call($popup, element);
}
else if($target.next(selector.popup).length !== 0) {
module.verbose('Pre-existing popup found');
settings.inline = true;
settings.popup = $target.next(selector.popup).data(metadata.activator, $module);
else if(settings.popup) {
$(settings.popup).data(metadata.activator, $module);
module.verbose('Used popup specified in settings');
module.refresh();
if(settings.hoverable) {
module.bind.popup();
}
}
else if(settings.popup) {
$(settings.popup).data(metadata.activator, $module);
module.verbose('Used popup specified in settings');
else if($target.next(selector.popup).length !== 0) {
module.verbose('Pre-existing popup found');
settings.inline = true;
settings.popup = $target.next(selector.popup).data(metadata.activator, $module);
module.refresh();
if(settings.hoverable) {
module.bind.popup();
Expand Down

0 comments on commit 4473b66

Please sign in to comment.