Skip to content
This repository was archived by the owner on Oct 8, 2021. It is now read-only.

Commit 1c5f7ed

Browse files
author
Gabriel Schulhof
committed
[popup] Avoid infinite recursion by detach()ing the payload from the container before attempting to put it back to its original place in the DOM (which may not exist, if the popup was created based on a detached element) -- Fixes #5244
Conflicts: js/widgets/popup.js
1 parent 56987c3 commit 1c5f7ed

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

js/widgets/popup.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -675,6 +675,13 @@ define( [ "jquery",
675675
// Put the element back to where the placeholder was and remove the "ui-popup" class
676676
self._setTheme( "none" );
677677
self.element
678+
// Cannot directly insertAfter() - we need to detach() first, because
679+
// insertAfter() will do nothing if the payload div was not attached
680+
// to the DOM at the time the widget was created, and so the payload
681+
// will remain inside the container even after we call insertAfter().
682+
// If that happens and we remove the container a few lines below, we
683+
// will cause an infinite recursion - #5244
684+
.detach()
678685
.insertAfter( self._ui.placeholder )
679686
.removeClass( "ui-popup ui-overlay-shadow ui-corner-all" );
680687
self._ui.screen.remove();

0 commit comments

Comments
 (0)