vojtech-dobes / history.nette.ajax.js

Adds History API support to nette.ajax.js addon!
30 stars 27 forks source link

Fixing condition in popstate event handler #36

Open zipper opened 7 years ago

zipper commented 7 years ago

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) {
...
zaxxx commented 7 years ago

:+1: Just bumped into same issue and this fix works.