Permalink
Browse files

loadPage: update to account for if the page is prefetched done update…

… 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...
1 parent a4d304d commit bb00a5b240fde3ff1c62d33997a1fc8758033c34 @arschmitz arschmitz committed with gabrielschulhof Feb 25, 2013
Showing with 11 additions and 7 deletions.
  1. +11 −7 js/jquery.mobile.navigation.js
@@ -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.
@@ -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
@@ -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 };
@@ -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();
}
@@ -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 );
}
@@ -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 } );
}
});
});

0 comments on commit bb00a5b

Please sign in to comment.