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

Fixing condition in popstate event handler #36

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

Conversation

zipper
Copy link
Contributor

@zipper zipper commented Jan 24, 2017

After merging #33, the popstate history stopped working at all. I believe the reason is that e.event is always undefined on this line. e is jQuery Event Object, which does not contain property event. The proposed and linked solution on stack overflow however uses native JS event. Therefore, the correct condition should be using e.originalEvent.state:

...
if (initialPop || !e.originalEvent.state) {
...

…nt Object, there is no `state` property defined, we need to use `e.originalEvent.state` instead
@zaxxx
Copy link

zaxxx commented Feb 13, 2017

👍 Just bumped into same issue and this fix works.

Copy link

@Tomas2D Tomas2D left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just wanted to pull the same thing! 👍

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.

3 participants