Browse files

[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


  • Loading branch information...
gabrielschulhof committed Nov 2, 2012
1 parent 56987c3 commit 1c5f7edf07fdca4ed58697ab0ac740783389f9c4
Showing with 7 additions and 0 deletions.
  1. +7 −0 js/widgets/popup.js
@@ -675,6 +675,13 @@ define( [ "jquery",
// Put the element back to where the placeholder was and remove the "ui-popup" class
self._setTheme( "none" );
// Cannot directly insertAfter() - we need to detach() first, because
// insertAfter() will do nothing if the payload div was not attached
// to the DOM at the time the widget was created, and so the payload
// will remain inside the container even after we call insertAfter().
// If that happens and we remove the container a few lines below, we
// will cause an infinite recursion - #5244
.insertAfter( self._ui.placeholder )
.removeClass( "ui-popup ui-overlay-shadow ui-corner-all" );

0 comments on commit 1c5f7ed

Please sign in to comment.