8000 widget's load method · jquery-archive/jquery-mobile@9cd7795 · GitHub
Skip to content
This repository was archived by the owner on Oct 8, 2021. It is now read-only.

Commit 9cd7795

Browse files
committed
widget's load method
1 parent 83c54b6 commit 9cd7795

File tree

1 file changed

+20
-17
lines changed

1 file changed

+20
-17
lines changed

js/jquery.mobile.navigation.js

+20-17
Original file line numberDiff line numberDiff line change
@@ -815,24 +815,27 @@ define( [
815815
// params have access to them in the event bindings for the page
816816
// life cycle See issue #5085
817817
settings.target = toPage;
818+
settings.deferred = $.Deferred();
818819

819-
$.mobile.loadPage( toPage, settings)
820-
.done(function( url, options, newPage ) {
821-
isPageTransitioning = false;
822-
823-
// store the original absolute url so that it can be provided
824-
// to events in the triggerData of the subsequent changePage call
825-
newPage.data( "absUrl", triggerData.absUrl );
826-
$.mobile.changePage( newPage, options );
827-
})
828-
.fail($.proxy(function(/* url, options */) {
829-
//clear out the active button state
830-
removeActiveLinkClass( true );
831-
832-
//release transition lock so navigation is free again
833-
releasePageTransitionLock();
834-
this.element.trigger( "pagechangefailed", triggerData );
835-
}, this));
820+
this.load( toPage, settings );
821+
822+
settings.deferred.done(function( url, options, newPage ) {
823+
isPageTransitioning = false;
824+
825+
// store the original absolute url so that it can be provided
826+
// to events in the triggerData of the subsequent changePage call
827+
newPage.data( "absUrl", triggerData.absUrl );
828+
$.mobile.changePage( newPage, options );
829+
});
830+
831+
settings.deferred.fail($.proxy(function(/* url, options */) {
832+
//clear out the active button state
833+
removeActiveLinkClass( true );
834+
835+
//release transition lock so navigation is free again
836+
releasePageTransitionLock();
837+
this.element.trigger( "pagechangefailed", triggerData );
838+
}, this));
836839

837840
return;
838841
}

0 commit comments

Comments
 (0)