diff --git a/backbone.js b/backbone.js index 5f18acf9..b5f1fea5 100644 --- a/backbone.js +++ b/backbone.js @@ -819,7 +819,7 @@ }; // Cached regex for cleaning leading hashes and slashes . - var routeStripper = /^[#\/]/; + var routeStripper = /^[#/]/; // Cached regex for detecting MSIE. var isExplorer = /msie [\w.]+/; diff --git a/test/router.js b/test/router.js index 79c19313..989eb026 100644 --- a/test/router.js +++ b/test/router.js @@ -200,4 +200,12 @@ $(document).ready(function() { } }); + test("#933, #908 - leading slash", function() { + var history = new Backbone.History(); + history.options = {root: '/root'}; + equal(history.getFragment('/root/foo'), 'foo'); + history.options.root = '/root/'; + equal(history.getFragment('/root/foo'), 'foo'); + }); + });