Merge pull request #1795 from braddunbar/trailing-space

Strip trailing space in fragments.
This commit is contained in:
Jeremy Ashkenas
2012-11-02 09:00:15 -07:00
2 changed files with 6 additions and 1 deletions

View File

@@ -989,7 +989,7 @@
};
// Cached regex for cleaning leading hashes and slashes.
var routeStripper = /^[#\/]/;
var routeStripper = /^[#\/]|\s+$/;
// Cached regex for stripping leading and trailing slashes.
var rootStripper = /^\/+|\/+$/g;

View File

@@ -492,4 +492,9 @@ $(document).ready(function() {
new Router;
});
test("#1794 - Trailing space in fragments.", 1, function() {
var history = new Backbone.History;
strictEqual(history.getFragment('fragment '), 'fragment');
});
});