Created
May 25, 2012 23:01
-
-
Save lthurston/2791063 to your computer and use it in GitHub Desktop.
jQuery Mobile 1.1 Modifications to Respect Static Base Href
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jquery.mobile-1.1.0.js | |
@@ -7,6 +7,7 @@ | |
* http://jquery.org/license | |
* | |
*/ | |
+ | |
(function ( root, doc, factory ) { | |
if ( typeof define === "function" && define.amd ) { | |
// AMD. Register as an anonymous module. | |
@@ -3097,8 +3098,9 @@ $.mobile.transitionFallbacks = {}; | |
page.jqmData( "title", newPageTitle ); | |
} | |
- //rewrite src and href attrs to use a base url | |
- if( !$.support.dynamicBaseTag ) { | |
+ // Rewrite src and href attrs to use a base url if dynamicBaseTag support is off and no | |
+ // static base href value is set | |
+ if( !$.support.dynamicBaseTag && $.mobile.staticBaseHref == undefined) { | |
var newPath = path.get( fileUrl ); | |
page.find( "[src], link[href], a[rel='external'], :jqmData(ajax='false'), a[target]" ).each(function() { | |
var thisAttr = $( this ).is( '[href]' ) ? 'href' : | |
@@ -3581,7 +3583,15 @@ $.mobile.transitionFallbacks = {}; | |
return false; | |
} | |
- var baseUrl = getClosestBaseUrl( $link ), | |
+ var baseUrl, href; | |
+ | |
+ // If staticBaseHref is set, then that's the baseURL we're using, otherwise, find the closest | |
+ // base url | |
+ if($.mobile.staticBaseHref === undefined) { | |
+ baseUrl = getClosestBaseUrl( $link ); | |
+ } else { | |
+ baseUrl = $.mobile.staticBaseHref; | |
+ } | |
//get href, if defined, otherwise default to empty hash | |
href = path.makeUrlAbsolute( $link.attr( "href" ) || "#", baseUrl ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment