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

Commit

Permalink
Changed urlParseRE to ignore space at beginning. This is expected
Browse files Browse the repository at this point in the history
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
jefflembeck committed Oct 25, 2012
1 parent 815d82b commit 0c44912
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion js/jquery.mobile.navigation.js
Expand Up @@ -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.
Expand Down
14 changes: 14 additions & 0 deletions tests/unit/navigation/navigation_core.js
Expand Up @@ -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.