Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

properly support the empty URI (a relative URI) #317

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from

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