Permalink
Browse files

Popup: Cannot reclaim dialog hash state when a data-rel="back" button…

… is clicked inside a popup, because we cannot tell the difference between a link of the form href="page-where-we-came-from" and a link of type data-rel="back"
1 parent de52c0a commit 437eae494f734960fb6f7d27e4c417a26d7844f3 @gabrielschulhof gabrielschulhof committed Dec 18, 2012
Showing with 9 additions and 11 deletions.
  1. +9 −11 js/widgets/popup.js
View
20 js/widgets/popup.js
@@ -705,7 +705,7 @@ define( [
},
_closePopup: function( e, data ) {
- var parsedDst, toUrl, o = this.options, close = { method: "_close" };
+ var parsedDst, toUrl, o = this.options, immediate = false;
// restore location on screen
window.scrollTo( 0, this._scrollTop );
@@ -721,22 +721,20 @@ define( [
parsedDst = $.mobile.path.parseUrl( parsedDst );
toUrl = parsedDst.pathname + parsedDst.search + parsedDst.hash;
- if ( this._myUrl !== toUrl ) {
+ if ( this._myUrl !== $.mobile.path.makeUrlAbsolute( toUrl ) ) {
// Going to a different page - close immediately
- close.arg = true;
+ immediate = true;
} else {
- close.method = "close";
e.preventDefault();
}
}
- 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 );
+ // 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( immediate );
},
// any navigation event after a popup is opened should close the popup

0 comments on commit 437eae4

Please sign in to comment.