Skip to content

Conversation

2is10
Copy link

@2is10 2is10 commented Jul 12, 2013

Before this commit, History.normalizeState treated the empty string URI ('') as if no URI had been specified, normalizing it to the current page location (History.getLocationHref()). This occurred because the empty string is a "falsy" value in JavaScript.

With this commit, History.normalizeState instead resolves the empty URI as it does other relative URIs (using History.getFullUrl), while still resorting to History.getLocationHref() if no URI is specified (i.e. oldState.url is null or undefined).

I ran the tests in Chrome, and this commit causes no change in outcome. It's easy to see that this would be the case, since none of the current tests use the empty URI. It's also easy to see (by inspection of History.getFullUrl) that this change has the desired effect and no undesired side effects. I'd be happy to see a test added for the empty URI... I'm just not sure where the best place to add it would be. The tests appear to be a carefully constructed sequence.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant