browserstate/history.js — pull request #317 by 2is10 (2013-07-12 20:37:23+00:00)
Title: properly support the empty URI (a relative URI)

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.