Permalink
Browse files

Changed urlParseRE to ignore space at beginning. This is expected

behavior in browsers. This used to result in pages changing to
"%20destination.html" instead of the now "destination.html". Fixes issue #4882
  • Loading branch information...
1 parent 815d82b commit 0c449121278c3711d376da97aa78e80663d58752 @jefflembeck jefflembeck committed Oct 25, 2012
Showing with 15 additions and 1 deletion.
  1. +1 −1 js/jquery.mobile.navigation.js
  2. +14 −0 tests/unit/navigation/navigation_core.js
@@ -38,7 +38,7 @@
// [15]: ?msg=1234&type=unread
// [16]: #msg-content
//
- urlParseRE: /^(((([^:\/#\?]+:)?(?:\/\/((?:(([^:@\/#\?]+)(?:\:([^:@\/#\?]+))?)@)?(([^:\/#\?]+)(?:\:([0-9]+))?))?)?)?((\/?(?:[^\/\?#]+\/+)*)([^\?#]*)))?(\?[^#]+)?)(#.*)?/,
+ urlParseRE: /^\s*(((([^:\/#\?]+:)?(?:\/\/((?:(([^:@\/#\?]+)(?:\:([^:@\/#\?]+))?)@)?(([^:\/#\?]+)(?:\:([0-9]+))?))?)?)?((\/?(?:[^\/\?#]+\/+)*)([^\?#]*)))?(\?[^#]+)?)(#.*)?/,
//Parse a URL into a structure that allows easy access to
//all of the URL components by name.
@@ -535,4 +535,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(){
+ ok( $.mobile.activePage.attr( "id" ), "external-test", "the correct page is loaded" );
+ start();
+ }
+ ]);
+ });
+
})(jQuery);

0 comments on commit 0c44912

Please sign in to comment.