Skip to content

Commit ea385c3

Browse files
author
Gabriel Schulhof
committed
[popup] Deal with the fact that hashchange will not happen if the page has already had a starting dialog hash key
1 parent d716d3b commit ea385c3

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

js/jquery.mobile.popup.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -401,6 +401,7 @@ define( [ "jquery",
401401
$( window ).one( "hashchange.popupBinder", function() {
402402
realInstallListener();
403403
});
404+
$.mobile.urlHistory.ignoreNextHashChange = true;
404405
$.mobile.path.set( activeEntry.url + $.mobile.dialogHashKey );
405406
$.mobile.urlHistory.addNew( activeEntry.url + $.mobile.dialogHashKey, activeEntry.transition, activeEntry.title, activeEntry.pageUrl, activeEntry.role );
406407
}
@@ -416,6 +417,12 @@ define( [ "jquery",
416417
}
417418

418419
if ( $.mobile.hashListeningEnabled && !abort ) {
420+
// Opera 11.62 build 1347 on Linux will not fire a hashchange when going back to an identical URL,
421+
// so we need to set one up with a timeout - make sure _onHashChange reacts well to being called
422+
// superfluously
423+
this._teardownHashChangeTimeout = setTimeout( function() {
424+
$( window ).trigger( "hashchange.popup" );
425+
}, 300 );
419426
window.history.back();
420427
}
421428
else {
@@ -571,6 +578,11 @@ define( [ "jquery",
571578
_onHashChange: function( immediate ) {
572579
this._haveNavHook = false;
573580

581+
if ( this._teardownHashChangeTimeout ) {
582+
clearTimeout( this._teardownHashChangeTimeout );
583+
this._teardownHashChangeTimeout = 0;
584+
}
585+
574586
if ( this._myOwnHashChange ) {
575587
this._myOwnHashChange = false;
576588
this._inProgress = false;

0 commit comments

Comments
 (0)