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

Commit 437eae4

Browse files
author
Gabriel Schulhof
committed
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 437eae4

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

js/widgets/popup.js

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -705,7 +705,7 @@ define( [
705705
},
706706

707707
_closePopup: function( e, data ) {
708-
var parsedDst, toUrl, o = this.options, close = { method: "_close" };
708+
var parsedDst, toUrl, o = this.options, immediate = false;
709709

710710
// restore location on screen
711711
window.scrollTo( 0, this._scrollTop );
@@ -721,22 +721,20 @@ define( [
721721
parsedDst = $.mobile.path.parseUrl( parsedDst );
722722
toUrl = parsedDst.pathname + parsedDst.search + parsedDst.hash;
723723

724-
if ( this._myUrl !== toUrl ) {
724+
if ( this._myUrl !== $.mobile.path.makeUrlAbsolute( toUrl ) ) {
725725
// Going to a different page - close immediately
726-
close.arg = true;
726+
immediate = true;
727727
} else {
728-
close.method = "close";
729728
e.preventDefault();
730729
}
731730
}
732731

733-
if ( close.method === "_close" ) {
734-
// remove nav bindings
735-
o.container.unbind( o.closeEvents );
736-
// unbind click handlers added when history is disabled
737-
this.element.undelegate( o.closeLinkSelector, o.closeLinkEvents );
738-
}
739-
this[ close.method ]( close.arg );
732+
// remove nav bindings
733+
o.container.unbind( o.closeEvents );
734+
// unbind click handlers added when history is disabled
735+
this.element.undelegate( o.closeLinkSelector, o.closeLinkEvents );
736+
737+
this._close( immediate );
740738
},
741739

742740
// any navigation event after a popup is opened should close the popup

0 commit comments

Comments
 (0)