devote / HTML5-History-API

HTML5 History API expansion for browsers not supporting pushState, replaceState
http://spb-piksel.ru
MIT License
1.02k stars 182 forks source link

popstate event #18

Closed nevar closed 11 years ago

nevar commented 11 years ago

Chromium Version 24.0.1312.68 (180326)

http://jsfiddle.net/PJYg5/9/

replaceState
popstate

http://jsfiddle.net/PJYg5/8/

replaceState

Is it correct behaviour? so mean I can't initialize state on page load?

devote commented 11 years ago

When using my library, the event will not fire popstate in Chorme at first boot.

You can use http://jsfiddle.net/PJYg5/5/

nevar commented 11 years ago

But this fire popstate, because pushState reset initialFire.

If I open http://jsfiddle.net/PJYg5/5/ in console have:

pushState
popstate
devote commented 11 years ago

Yes, you right... Now I will correct it

devote commented 11 years ago

fixed

nevar commented 11 years ago

Thanks. Now it work as expected.

ThaNarie commented 11 years ago

Hi,

I have an issue that happens because the initialFire is not reset. If I revert the change from this ticket it is working again. After loading the page, I do a pushState, and a 'browser-back', and the popState doesn't fire because the initialFire still held the original value.

I'm loading history.js via requirejs, so the dom has already been loaded. Because of this, the 'load' and 'timeout' that should reset the initialFire are not executed. Maybe there should also be a domReady check, that resets when the document was ready before history was loaded?

devote commented 11 years ago

ThaNarie, You're right, there is a problem. And it will be fixed in the new version of the library, which very soon will have the status of the release.