Page loses "ui-page-active" class when popup close button is pressed.

Page loses "ui-page-active" class when popup close button is pressed.

Hi,
      Been working with JQM for a while now, but I have finally run into an issue that i can not seem to solve though diligent Google searching.  So I thought I would signup and ask the experts.

I am using internal linked pages that are  dynamically   cloned from templates, modified, then injected into the html markup.  Everything seems to work fine, however, occasionally , when I close any of the popups, the "ui-page-active" is removed from the current page, and nothing is visible (white browser background).  There is a brief moment between the popup closing and the fade to white, as if the change page is occurring.  This does not happen every time, but still quite often.

I have tried removing the data-rel="back" from the close button and binding .popup("close") to a click event, but it made no difference.



Any thoughts?


// jquery-2.1.0.js
// jquery.mobile-1.4.0.js
// jquery-ui-1.10.4.js