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

Ajax and "base" tag #3273

Closed
wants to merge 10 commits into from
8 changes: 4 additions & 4 deletions js/jquery.mobile.navigation.js
Original file line number Diff line number Diff line change
Expand Up @@ -761,7 +761,7 @@ define( [
}

if ( base ) {
base.set( fileUrl );
//base.set( fileUrl );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes the whole branch a no-op. If that's the intention maybe just remove it?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I'm not mistaken, that line is necessary to make sure that images within the page load properly. The problem here is that I think the base should be set to the fileUrl, or in the case where the page we just loaded contains a base tag, it should be set to that base tag path.

}

//workaround to allow scripts to execute when included in page divs
Expand Down Expand Up @@ -1140,7 +1140,7 @@ define( [
var url = $( ele ).closest( ".ui-page" ).jqmData( "url" ),
base = documentBase.hrefNoHash;

if ( !url || !path.isPath( url ) ) {
if ( !url || !path.isPath( url ) || || $.support.dynamicBaseTag ) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like you've got a double || here for some reason.

url = base;
}

Expand Down Expand Up @@ -1294,7 +1294,7 @@ define( [
}

// Should we handle this link, or let the browser deal with it?
var useDefaultUrlHandling = $link.is( "[rel='external']" ) || $link.is( ":jqmData(ajax='false')" ) || $link.is( "[target]" ),
var useDefaultUrlHandling = $link.is( "[rel='external']" ) || $link.is( ":jqmData(ajax='false')" ) || ( $link.is( "[target]" ) && !$link.is( "[target='_top']" ) ),

// Some embedded browsers, like the web view in Phone Gap, allow cross-domain XHR
// requests if the document doing the request was loaded via the file:// protocol.
Expand Down Expand Up @@ -1332,7 +1332,7 @@ define( [
//prefetch pages when anchors with data-prefetch are encountered
$( document ).delegate( ".ui-page", "pageshow.prefetch", function() {
var urls = [];
$( this ).find( "a:jqmData(prefetch)" ).each(function(){
$( this ).find( "a:jqmData(prefetch), link:jqmData(prefetch)" ).each(function(){
var $link = $(this),
url = $link.attr( "href" );

Expand Down
2 changes: 1 addition & 1 deletion js/jquery.mobile.support.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ function baseTagTest() {
if ( !base.length ) {
base = fauxEle = $( "<base>", { "href": fauxBase }).appendTo( "head" );
} else {
href = base.attr( "href" );
href = fauxEle = base.attr( "href" );
}

link = $( "<a href='testurl' />" ).prependTo( fakeBody );
Expand Down