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

Commit 616ae09

Browse files
author
Gabriel Schulhof
committed
[popup] When destroying a popup, run close() before un-enhancing if it is the currently active popup -- Fixes #5123
1 parent 4ca6df1 commit 616ae09

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

js/widgets/popup.js

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -654,12 +654,9 @@ define( [ "jquery",
654654
});
655655
},
656656

657-
_destroy: function() {
657+
_unenhance: function() {
658658
var self = this;
659659

660-
// hide and remove bindings
661-
self._close();
662-
663660
// Put the element back to where the placeholder was and remove the "ui-popup" class
664661
self._setTheme( "none" );
665662
self.element
@@ -677,6 +674,15 @@ define( [ "jquery",
677674
});
678675
},
679676

677+
_destroy: function() {
678+
if ( $.mobile.popup.active === this ) {
679+
this.element.one( "popupafterclose", $.proxy( this, "_unenhance" ) );
680+
this.close();
681+
} else {
682+
this._unenhance();
683+
}
684+
},
685+
680686
// any navigation event after a popup is opened should close the popup
681687
// NOTE the pagebeforechange is bound to catch navigation events that don't
682688
// alter the url (eg, dialogs from popups)

0 commit comments

Comments
 (0)