Skip to content

Commit 0586202

Browse files
author
Gabriel Schulhof
committed
[popup] When destroying a popup, run close() before un-enhancing if it is the currently active popup -- Fixes jquery-archive#5123
1 parent 86de757 commit 0586202

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
@@ -646,10 +646,7 @@ define( [ "jquery",
646646
});
647647
},
648648

649-
_destroy: function() {
650-
// hide and remove bindings
651-
this._close();
652-
649+
_unenhance: function() {
653650
// Put the element back to where the placeholder was and remove the "ui-popup" class
654651
this._setTheme( "none" );
655652
this.element
@@ -660,6 +657,15 @@ define( [ "jquery",
660657
this._ui.placeholder.remove();
661658
},
662659

660+
_destroy: function() {
661+
if ( $.mobile.popup.active === this ) {
662+
this.element.one( "popupafterclose", $.proxy( this, "_unenhance" ) );
663+
this.close();
664+
} else {
665+
this._unenhance();
666+
}
667+
},
668+
663669
// any navigation event after a popup is opened should close the popup
664670
// NOTE the pagebeforechange is bound to catch navigation events that don't
665671
// alter the url (eg, dialogs from popups)

0 commit comments

Comments
 (0)