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

Commit 68d2ccd

Browse files
marcuskrahlGabriel Schulhof
authored and
Gabriel Schulhof
committed
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
1 parent 58be1f7 commit 68d2ccd

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

js/widgets/pagecontainer.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -637,7 +637,7 @@ define( [
637637
$.mobile.path.isEmbeddedPage(fileUrl) &&
638638
!$.mobile.path.isFirstPageUrl(fileUrl) ) {
639639
deferred.reject( absUrl, settings );
640-
return;
640+
return deferred.promise();
641641
}
642642

643643
// Reset base to the default document base
@@ -658,7 +658,7 @@ define( [
658658
this._getBase().set(url);
659659
}
660660

661-
return;
661+
return deferred.promise();
662662
}
663663

664664
triggerData = {
@@ -675,7 +675,7 @@ define( [
675675
// If the default behavior is prevented, stop here!
676676
if ( pblEvent.deprecatedEvent.isDefaultPrevented() ||
677677
pblEvent.event.isDefaultPrevented() ) {
678-
return;
678+
return deferred.promise();
679679
}
680680

681681
if ( settings.showLoadMsg ) {
@@ -691,7 +691,7 @@ define( [
691691
if ( !( $.mobile.allowCrossDomainPages ||
692692
$.mobile.path.isSameDomain($.mobile.path.documentUrl, absUrl ) ) ) {
693693
deferred.reject( absUrl, settings );
694-
return;
694+
return deferred.promise();
695695
}
696696

697697
// Load the new content.
@@ -704,6 +704,8 @@ define( [
704704
success: this._loadSuccess( absUrl, triggerData, settings, deferred ),
705705
error: this._loadError( absUrl, triggerData, settings, deferred )
706706
});
707+
708+
return deferred.promise();
707709
},
708710

709711
_loadError: function( absUrl, triggerData, settings, deferred ) {

0 commit comments

Comments
 (0)