Permalink
Browse files

Page container: the load method now correctly returns a promise

The API docs for version 1.4.0 state that the load method of the pagecontainer
widget returns a promise. This commit adds this behaviour to the widget to
comply with the docs.

Closes gh-6901
Fixes gh-6900
  • Loading branch information...
marcuskrahl authored and gabrielschulhof committed Jan 8, 2014
1 parent 58be1f7 commit 68d2ccd3c8c05f99fd2a82553a772feb2dd19168
Showing with 6 additions and 4 deletions.
  1. +6 −4 js/widgets/pagecontainer.js
@@ -637,7 +637,7 @@ define( [
$.mobile.path.isEmbeddedPage(fileUrl) &&
!$.mobile.path.isFirstPageUrl(fileUrl) ) {
deferred.reject( absUrl, settings );
- return;
+ return deferred.promise();
}
// Reset base to the default document base
@@ -658,7 +658,7 @@ define( [
this._getBase().set(url);
}
- return;
+ return deferred.promise();
}
triggerData = {
@@ -675,7 +675,7 @@ define( [
// If the default behavior is prevented, stop here!
if ( pblEvent.deprecatedEvent.isDefaultPrevented() ||
pblEvent.event.isDefaultPrevented() ) {
- return;
+ return deferred.promise();
}
if ( settings.showLoadMsg ) {
@@ -691,7 +691,7 @@ define( [
if ( !( $.mobile.allowCrossDomainPages ||
$.mobile.path.isSameDomain($.mobile.path.documentUrl, absUrl ) ) ) {
deferred.reject( absUrl, settings );
- return;
+ return deferred.promise();
}
// Load the new content.
@@ -704,6 +704,8 @@ define( [
success: this._loadSuccess( absUrl, triggerData, settings, deferred ),
error: this._loadError( absUrl, triggerData, settings, deferred )
});
+
+ return deferred.promise();
},
_loadError: function( absUrl, triggerData, settings, deferred ) {

0 comments on commit 68d2ccd

Please sign in to comment.