Permalink
Browse files

Popup: There is a case when bindings must not be released during _clo…

…sePopup()
  • Loading branch information...
1 parent f071078 commit fe3d93ee25dd840cdb51370e0358461d53ee4eac @gabrielschulhof gabrielschulhof committed Dec 12, 2012
Showing with 10 additions and 12 deletions.
  1. +10 −12 js/widgets/popup.js
View
@@ -691,17 +691,11 @@ define( [ "jquery",
},
_closePopup: function( e, data ) {
- var parsedDst, toUrl, o = this.options;
+ var parsedDst, toUrl, o = this.options, close = { method: "_close" };
// restore location on screen
window.scrollTo( 0, this._scrollTop );
- // remove nav bindings
- o.container.unbind( o.closeEvents );
-
- // unbind click handlers added when history is disabled
- this.element.undelegate( o.closeLinkSelector, o.closeLinkEvents );
-
if ( e && e.type === "pagebeforechange" && data ) {
// Determine whether we need to rapid-close the popup, or whether we can
// take the time to run the closing transition
@@ -715,16 +709,20 @@ define( [ "jquery",
if ( this._myUrl !== toUrl ) {
// Going to a different page - close immediately
- this._close( true );
+ close.arg = true;
} else {
- this.close();
+ close.method = "close";
e.preventDefault();
}
-
- return;
}
- this._close();
+ if ( close.method === "_close" ) {
+ // remove nav bindings
+ o.container.unbind( o.closeEvents );
+ // unbind click handlers added when history is disabled
+ this.element.undelegate( o.closeLinkSelector, o.closeLinkEvents );
+ }
+ this[ close.method ]( close.arg );
},
// any navigation event after a popup is opened should close the popup

0 comments on commit fe3d93e

Please sign in to comment.