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

Commit

Permalink
loadPage: update to account for if the page is prefetched done update…
Browse files Browse the repository at this point in the history
… basetag. Fixed #5677 - Navigation: Prefetching pages from other directories offsets <base>-tag

(cherry picked from commit be22887)

Conflicts:
	js/jquery.mobile.navigation.js
  • Loading branch information
arschmitz authored and Gabriel Schulhof committed Mar 12, 2013
1 parent a4d304d commit bb00a5b
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions js/jquery.mobile.navigation.js
Expand Up @@ -726,6 +726,7 @@ define( [
.attr( "data-" + $.mobile.ns + "url", dataUrl );
}


// If we failed to find a page in the DOM, check the URL to see if it
// refers to the first page in the application. If it isn't a reference
// to the first page and refers to non-existent embedded page, error out.
Expand All @@ -747,7 +748,7 @@ define( [
return deferred.promise();
}
}

// If the page we are interested in is already in the DOM,
// and the caller did not indicate that we should force a
// reload of the file, we are done. Otherwise, track the
Expand All @@ -756,11 +757,14 @@ define( [
if ( !settings.reloadPage ) {
enhancePage( page, settings.role );
deferred.resolve( absUrl, options, page );
//if we are reloading the page make sure we update the base if its not a prefetch
if( base && !options.prefetch ){
base.set(url);
}
return deferred.promise();
}
dupCachedPage = page;
}

var mpc = settings.pageContainer,
pblEvent = new $.Event( "pagebeforeload" ),
triggerData = { url: url, absUrl: absUrl, dataUrl: dataUrl, deferred: deferred, options: settings };
Expand Down Expand Up @@ -790,9 +794,9 @@ define( [
$.mobile.hidePageLoadingMsg();
};
}

// Reset base to the default document base.
if ( base ) {
// only reset if we are not prefetching
if ( base && typeof options.prefetch === "undefined" ) {
base.reset();
}

Expand Down Expand Up @@ -826,8 +830,8 @@ define( [
&& RegExp.$1 ) {
url = fileUrl = path.getFilePath( RegExp.$1 );
}

if ( base ) {
//dont update the base tag if we are prefetching
if ( base && typeof options.prefetch === "undefined") {
base.set( fileUrl );
}

Expand Down Expand Up @@ -1430,7 +1434,7 @@ define( [
if ( url && $.inArray( url, urls ) === -1 ) {
urls.push( url );

$.mobile.loadPage( url, {role: $link.attr("data-" + $.mobile.ns + "rel")} );
$.mobile.loadPage( url, { role: $link.attr( "data-" + $.mobile.ns + "rel" ),prefetch: true } );
}
});
});
Expand Down

0 comments on commit bb00a5b

Please sign in to comment.