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

Commit 0c44912

Browse files
committed
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
1 parent 815d82b commit 0c44912

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

js/jquery.mobile.navigation.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
// [15]: ?msg=1234&type=unread
3939
// [16]: #msg-content
4040
//
41-
urlParseRE: /^(((([^:\/#\?]+:)?(?:\/\/((?:(([^:@\/#\?]+)(?:\:([^:@\/#\?]+))?)@)?(([^:\/#\?]+)(?:\:([0-9]+))?))?)?)?((\/?(?:[^\/\?#]+\/+)*)([^\?#]*)))?(\?[^#]+)?)(#.*)?/,
41+
urlParseRE: /^\s*(((([^:\/#\?]+:)?(?:\/\/((?:(([^:@\/#\?]+)(?:\:([^:@\/#\?]+))?)@)?(([^:\/#\?]+)(?:\:([0-9]+))?))?)?)?((\/?(?:[^\/\?#]+\/+)*)([^\?#]*)))?(\?[^#]+)?)(#.*)?/,
4242

4343
//Parse a URL into a structure that allows easy access to
4444
//all of the URL components by name.

tests/unit/navigation/navigation_core.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -535,4 +535,18 @@
535535
}
536536
]);
537537
});
538+
539+
asyncTest( "external page is accessed correctly even if it has a space in the url", function(){
540+
$.testHelper.pageSequence([
541+
function(){
542+
$.mobile.changePage( " external.html" );
543+
},
544+
545+
function(){
546+
ok( $.mobile.activePage.attr( "id" ), "external-test", "the correct page is loaded" );
547+
start();
548+
}
549+
]);
550+
});
551+
538552
})(jQuery);

0 commit comments

Comments
 (0)