diff --git a/js/jquery.mobile.navigation.js b/js/jquery.mobile.navigation.js index 76633340f56..8bb54044d01 100644 --- a/js/jquery.mobile.navigation.js +++ b/js/jquery.mobile.navigation.js @@ -47,7 +47,7 @@ define( [ // [16]: ?msg=1234&type=unread // [17]: #msg-content // - urlParseRE: /^(((([^:\/#\?]+:)?(?:(\/\/)((?:(([^:@\/#\?]+)(?:\:([^:@\/#\?]+))?)@)?(([^:\/#\?\]\[]+|\[[^\/\]@#?]+\])(?:\:([0-9]+))?))?)?)?((\/?(?:[^\/\?#]+\/+)*)([^\?#]*)))?(\?[^#]+)?)(#.*)?/, + urlParseRE: /^\s*(((([^:\/#\?]+:)?(?:(\/\/)((?:(([^:@\/#\?]+)(?:\:([^:@\/#\?]+))?)@)?(([^:\/#\?\]\[]+|\[[^\/\]@#?]+\])(?:\:([0-9]+))?))?)?)?((\/?(?:[^\/\?#]+\/+)*)([^\?#]*)))?(\?[^#]+)?)(#.*)?/, // Abstraction to address xss (Issue #4787) by removing the authority in // browsers that auto decode it. All references to location.href should be diff --git a/tests/unit/navigation/navigation_core.js b/tests/unit/navigation/navigation_core.js index 9e8548d47c6..7908135834f 100644 --- a/tests/unit/navigation/navigation_core.js +++ b/tests/unit/navigation/navigation_core.js @@ -1307,4 +1307,18 @@ } ]); }); + + asyncTest( "external page is accessed correctly even if it has a space in the url", function(){ + $.testHelper.pageSequence([ + function(){ + $.mobile.changePage( " external.html" ); + }, + function(){ + equal( $.mobile.activePage.attr( "id" ), "external-test", "the correct page is loaded" ); + start(); + } + + ]); + }); + })(jQuery);