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

Commit

Permalink
Popup: Systematically merge link options and widget options during _o…
Browse files Browse the repository at this point in the history
…pen().
  • Loading branch information
Gabriel Schulhof committed Dec 3, 2012
1 parent f7609f2 commit 428d5de
Showing 1 changed file with 7 additions and 16 deletions.
23 changes: 7 additions & 16 deletions js/widgets/popup.js
Expand Up @@ -540,7 +540,8 @@ define( [ "jquery",
},

_open: function( options ) {
var coords, transition,
var coords,
o = $.extend( {}, this.options, options ),
androidBlacklist = ( function() {
var w = window,
ua = navigator.userAgent,
Expand All @@ -558,16 +559,10 @@ define( [ "jquery",
return false;
}());

// Make sure options is defined
options = ( options || {} );

// Copy out the transition, because we may be overwriting it later and we don't want to pass that change back to the caller
transition = options.transition || this.options.transition;

// Give applications a chance to modify the contents of the container before it appears
this._trigger( "beforeposition" );

coords = this._placementCoords( this._desiredCoords( options.x, options.y, options.positionTo || this.options.positionTo || "origin" ) );
coords = this._placementCoords( this._desiredCoords( o.x, o.y, o.positionTo ) );

// Count down to triggering "popupafteropen" - we have two prerequisites:
// 1. The popup window animation completes (container())
Expand All @@ -577,12 +572,8 @@ define( [ "jquery",
$.noop,
$.proxy( this, "_openPrereqsComplete" ) );

if ( transition ) {
this._currentTransition = transition;
this._applyTransition( transition );
} else {
transition = this.options.transition;
}
this._currentTransition = o.transition;
this._applyTransition( o.transition );

if ( !this.options.theme ) {
this._setTheme( this._page.jqmData( "theme" ) || $.mobile.getInheritedTheme( this._page, "c" ) );
Expand Down Expand Up @@ -613,7 +604,7 @@ define( [ "jquery",
}
this._animate({
additionalCondition: true,
transition: transition,
transition: o.transition,
classToRemove: "",
screenClassToAdd: "in",
containerClassToAdd: "in",
Expand Down Expand Up @@ -663,7 +654,7 @@ define( [ "jquery",

this._animate( {
additionalCondition: this._ui.screen.hasClass( "in" ),
transition: ( immediate ? "none" : ( this._currentTransition || this.options.transition ) ),
transition: ( immediate ? "none" : ( this._currentTransition ) ),
classToRemove: "in",
screenClassToAdd: "out",
containerClassToAdd: "reverse out",
Expand Down

0 comments on commit 428d5de

Please sign in to comment.