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

Commit

Permalink
Popup: Make it work when built on its own - this time for real
Browse files Browse the repository at this point in the history
  • Loading branch information
Gabriel Schulhof committed Mar 14, 2013
1 parent 424a6c4 commit a8bc1c3
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions js/widgets/popup.js
Original file line number Diff line number Diff line change
Expand Up @@ -748,6 +748,10 @@ define( [
_closePopup: function( e, data ) {
var parsedDst, toUrl, o = this.options, immediate = false;

if ( e && e.isDefaultPrevented() ) {
return;
}

// restore location on screen
window.scrollTo( 0, this._scrollTop );

Expand All @@ -771,7 +775,7 @@ define( [
}

// remove nav bindings
o.container.unbind( o.closeEvents );
$.mobile.window.off( o.closeEvents );
// unbind click handlers added when history is disabled
this.element.undelegate( o.closeLinkSelector, o.closeLinkEvents );

Expand All @@ -782,8 +786,8 @@ define( [
// NOTE the pagebeforechange is bound to catch navigation events that don't
// alter the url (eg, dialogs from popups)
_bindContainerClose: function() {
this.options.container
.one( this.options.closeEvents, $.proxy( this, "_closePopup" ) );
$.mobile.window
.on( this.options.closeEvents, $.proxy( this, "_closePopup" ) );
},

// TODO no clear deliniation of what should be here and
Expand Down Expand Up @@ -822,7 +826,7 @@ define( [
urlHistory = $.mobile.urlHistory;
hashkey = $.mobile.dialogHashKey;
activePage = $.mobile.activePage;
currentIsDialog = activePage.hasClass( "ui-dialog" );
currentIsDialog = ( activePage ? activePage.hasClass( "ui-dialog" ) : false );
this._myUrl = url = urlHistory.getActive().url;
hasHash = ( url.indexOf( hashkey ) > -1 ) && !currentIsDialog && ( urlHistory.activeIndex > 0 );

Expand Down

0 comments on commit a8bc1c3

Please sign in to comment.