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

add simple test illustrating hashchange event breakage #59

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

Conversation

ahamid
Copy link

@ahamid ahamid commented Jun 21, 2014

I believe this test demonstrates that the standard hashchange event is broken.

In onHashChangeEvent, fireNow and lastURL values are different, and appear to capture the last [sic] and next [sic] hash values.

function onHashChange(event) {
 // https://github.com/devote/HTML5-History-API/issues/46
 var fireNow = lastURL;
 // new value to lastURL
 lastURL = windowLocation.href;

e..g

> fireNow
"file:///home/user/workspace/HTML5-History-API/test/test_hashchange_html5.html"
> lastURL
"file:///home/user/workspace//HTML5-History-API/test/test_hashchange_html5.html#/path"

however, later, the lastURL and newURL values are compared, and they are identical

var oldURLObject = parseURL(lastURL, true);
var newURLObject = parseURL();
...
if (oldURLObject._hash !== newURLObject._hash) {
  // if current hash not equal previous hash
  dispatchEvent(event);
}

and the event is never fired.

@devote
Copy link
Owner

devote commented Jun 21, 2014

Hi,

Thank you very much for pointing out the error. This I did not complete the problem associated with #46

Now I fixed the problem and now it should work fine.

devote added a commit that referenced this pull request Jun 21, 2014
@devote devote added the bug label Jun 21, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants