diff --git a/CHANGES.md b/CHANGES.md index bdd7fce07..87f6bf729 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,5 +1,7 @@ ## [HEAD] +- `createHashHistory` now only handles hashes that start with a '/' as only those urls may be created by the history + - Disable browser history on Chrome iOS ([#146]) - Add ES2015 module build ([#152]) diff --git a/modules/__tests__/HashHistory-test.js b/modules/__tests__/HashHistory-test.js index 9483cc43f..633d4a07c 100644 --- a/modules/__tests__/HashHistory-test.js +++ b/modules/__tests__/HashHistory-test.js @@ -15,8 +15,8 @@ import describeGo from './describeGo' describe('hash history', function () { beforeEach(function () { - if (window.location.hash !== '') - window.location.hash = '' + if (window.location.hash !== '/') + window.location.hash = '/' }) describeInitialLocation(createHashHistory) diff --git a/modules/createHashHistory.js b/modules/createHashHistory.js index 10a5532e6..a322330af 100644 --- a/modules/createHashHistory.js +++ b/modules/createHashHistory.js @@ -71,8 +71,8 @@ function createHashHistory(options={}) { function startHashChangeListener({ transitionTo }) { function hashChangeListener() { - if (!ensureSlash()) - return // Always make sure hashes are preceeded with a /. + if (!isAbsolutePath(getHashPath())) + return // Only handle hashes which are could be created by the history. transitionTo( getCurrentLocation()