Skip to content
This repository
Browse code

Fix for issue 1243 - Can't link to dynamically created data-role="page"

- Modified loadPage() so that if the data-url lookup for a given page fails, that it look for the page via id (if it is an embedded page URL). This allows us to find dynamically injected pages that are un-enhanced and missing their data-url attributes.
  • Loading branch information...
commit 80b0e9979899cac49f9e13f677c83532c8c1bf4b 1 parent 61eed99
Kin Blas authored

Showing 1 changed file with 9 additions and 0 deletions. Show diff stats Hide diff stats

  1. 9  js/jquery.mobile.navigation.js
9  js/jquery.mobile.navigation.js
@@ -662,6 +662,15 @@
662 662
 		// Check to see if the page already exists in the DOM.
663 663
 		page = settings.pageContainer.children( ":jqmData(url='" + dataUrl + "')" );
664 664
 
  665
+		// If we failed to find the page, check to see if the url is a
  666
+		// reference to an embedded page. If so, it may have been dynamically
  667
+		// injected by a developer, in which case it would be lacking a data-url
  668
+		// attribute and in need of enhancement.
  669
+		if ( page.length === 0 && !path.isPath( dataUrl ) ) {
  670
+			page = settings.pageContainer.children( "#" + dataUrl )
  671
+				.attr( "data-" + $.mobile.ns + "url", dataUrl )
  672
+		}
  673
+
665 674
 		// If we failed to find a page in the DOM, check the URL to see if it
666 675
 		// refers to the first page in the application.
667 676
 		if ( page.length === 0 && $.mobile.firstPage && path.isFirstPageUrl( absUrl ) ) {

0 notes on commit 80b0e99

Please sign in to comment.
Something went wrong with that request. Please try again.