Showing with 13 additions and 23 deletions.
  1. +13 −23 js/widgets/popup.js
@@ -153,7 +153,7 @@ define( [ "jquery",
// We need to adjust the history option to be false if there's no AJAX nav.
// We can't do it in the option declarations because those are run before
// it is determined whether there shall be AJAX nav.
this.options.history = this.options.history && $.mobile.ajaxEnabled;
this.options.history = this.options.history && $.mobile.ajaxEnabled;

if ( thisPage.length === 0 ) {
thisPage = $( "body" );
@@ -574,7 +574,7 @@ define( [ "jquery",
/* TODO:
The native browser on Android 4.0.X ("Ice Cream Sandwich") suffers from an issue where the popup overlay appears to be z-indexed
above the popup itself when certain other styles exist on the same page -- namely, any element set to `position: fixed` and certain
types of input. These issues are reminiscent of previously uncovered bugs in older versions of Android's native browser:
types of input. These issues are reminiscent of previously uncovered bugs in older versions of Androids native browser:
https://github.com/scottjehl/Device-Bugs/issues/3
This fix closes the following bugs ( I use "closes" with reluctance, and stress that this issue should be revisited as soon as possible ):
@@ -690,7 +690,7 @@ define( [ "jquery",
// TODO no clear deliniation of what should be here and
// what should be in _open. Seems to be "visual" vs "history" for now
open: function( options ) {
var self = this, opts = this.options, url, hashkey, activePage, currentIsDialog, hasHash, urlHistory;
var self = this, opts = this.options, url, hashkey, activePage;

// make sure open is idempotent
if( $.mobile.popup.active ) {
@@ -702,7 +702,7 @@ define( [ "jquery",

// if history alteration is disabled close on navigate events
// and leave the url as is
if( !( opts.history && $.mobile.hashListeningEnabled ) ) {
if( !opts.history ) {
self._open( options );
self._bindContainerClose();

@@ -725,41 +725,31 @@ define( [ "jquery",
// cache some values for min/readability
hashkey = $.mobile.dialogHashKey;
activePage = $.mobile.activePage;
currentIsDialog = activePage.is( ".ui-dialog" );
url = $.mobile.urlHistory.getActive().url;
hasHash = ( url.indexOf( hashkey ) > -1 ) && !currentIsDialog;
urlHistory = $.mobile.urlHistory;

if ( hasHash ) {
self._open( options );
self._bindContainerClose();
return;
}
// NOTE I'm not 100% that this is the right place to get the default url
url = activePage.jqmData( "url" );

// if the current url has no dialog hash key proceed as normal
// otherwise, if the page is a dialog simply tack on the hash key
if ( url.indexOf( hashkey ) === -1 && !currentIsDialog ){
if ( url.indexOf( hashkey ) === -1
&& !activePage.is( ".ui-dialog" )
&& $.mobile.urlHistory.activeIndex !== 0 ){
url = url + hashkey;
} else {
url = $.mobile.path.parseLocation().hash + hashkey;
}

// Tack on an extra hashkey if this is the first page and we've just reconstructed the initial hash
if ( urlHistory.activeIndex === 0 && url === urlHistory.initialDst ) {
url += hashkey;
}

// swallow the the initial navigation event, and bind for the next
opts.container.one( opts.navigateEvents, function( e ) {
e.preventDefault();
self._open( options );
self._bindContainerClose();
});

urlHistory.ignoreNextHashChange = currentIsDialog;
// forward the options on to the visual open
self._open( options );
});

// Gotta love methods with 1mm args :(
urlHistory.addNew( url, undefined, undefined, undefined, "dialog" );
$.mobile.urlHistory.addNew( url, undefined, undefined, undefined, "dialog" );

// set the new url with (or without) the new dialog hash key
$.mobile.path.set( url );