Permalink
Browse files

render prefetched pages according to their data-rel attr fixes #2335

  • Loading branch information...
johnbender committed Oct 11, 2011
1 parent 475069b commit f0db137ed9b7bfd3bfb0efb7c5beafc9c53998c0
Showing with 7 additions and 4 deletions.
  1. +7 −4 js/jquery.mobile.navigation.js
@@ -1350,16 +1350,19 @@
});
//prefetch pages when anchors with data-prefetch are encountered
- $( ".ui-page" ).live( "pageshow.prefetch", function(){
+ $( ".ui-page" ).live( "pageshow.prefetch", function() {
var urls = [];
$( this ).find( "a:jqmData(prefetch)" ).each(function(){
- var url = $( this ).attr( "href" );
+ var $link = $(this),
+ url = $link.attr( "href" );
+
if ( url && $.inArray( url, urls ) === -1 ) {
urls.push( url );
- $.mobile.loadPage( url );
+
+ $.mobile.loadPage( url, {role: $link.attr("data-" + $.mobile.ns + "rel")} );
}
});
- } );
+ });
$.mobile._handleHashChange = function( hash ) {
//find first page via hash

0 comments on commit f0db137

Please sign in to comment.