Skip to content
Browse files

[popup] When destroying a popup, run close() before un-enhancing if i…

…t is the currently active popup -- Fixes #5123
  • Loading branch information...
1 parent 4ca6df1 commit 616ae0978abfbf6111ea497d0aebf31f3e330b69 @gabrielschulhof gabrielschulhof committed Oct 4, 2012
Showing with 10 additions and 4 deletions.
  1. +10 −4 js/widgets/popup.js
View
14 js/widgets/popup.js
@@ -654,12 +654,9 @@ define( [ "jquery",
});
},
- _destroy: function() {
+ _unenhance: function() {
var self = this;
- // hide and remove bindings
- self._close();
-
// Put the element back to where the placeholder was and remove the "ui-popup" class
self._setTheme( "none" );
self.element
@@ -677,6 +674,15 @@ define( [ "jquery",
});
},
+ _destroy: function() {
+ if ( $.mobile.popup.active === this ) {
+ this.element.one( "popupafterclose", $.proxy( this, "_unenhance" ) );
+ this.close();
+ } else {
+ this._unenhance();
+ }
+ },
+
// any navigation event after a popup is opened should close the popup
// NOTE the pagebeforechange is bound to catch navigation events that don't
// alter the url (eg, dialogs from popups)

0 comments on commit 616ae09

Please sign in to comment.
Something went wrong with that request. Please try again.