trying to use new popup to show different types of contents.
Got a function which accepts $html and show it in runtime added popup.
If any previous data-role='popup' exist then remove it from DOM.
Issue: calling remove() firing popupafterclose.
To replicate: click button second time which fires popupafterclose twice. Once on remove() of previous popup and on actual popupafterclose.(see console.log)
[popup] When destroying a popup, run close() before un-enhancing if i…
…t is the currently active popup -- Fixes #5123