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

Commit 8199f24

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
1 parent 4895716 commit 8199f24

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
@@ -683,6 +683,13 @@ define( [ "jquery",
683683
// Put the element back to where the placeholder was and remove the "ui-popup" class
684684
this._setTheme( "none" );
685685
this.element
686+
// Cannot directly insertAfter() - we need to detach() first, because
687+
// insertAfter() will do nothing if the payload div was not attached
688+
// to the DOM at the time the widget was created, and so the payload
689+
// will remain inside the container even after we call insertAfter().
690+
// If that happens and we remove the container a few lines below, we
691+
// will cause an infinite recursion - #5244
692+
.detach()
686693
.insertAfter( this._ui.placeholder )
687694
.removeClass( "ui-popup ui-overlay-shadow ui-corner-all" );
688695
this._ui.screen.remove();

0 commit comments

Comments
 (0)