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

Back button won't trigger destructors #24

Closed
foobear opened this Issue Jul 31, 2017 · 4 comments

Comments

Projects
None yet
3 participants
@foobear
Contributor

foobear commented Jul 31, 2017

Using the back button does not trigger destructors.

Since compilers would need to clean up event listeners bound to other elements (like document), they can not do that. The compiler will be re-initialized and re-register its event listener a second time.

Example files can be found here: https://gist.github.com/foobear/a9b2b2a678cdd948e934c0e61138a5b6

The example above was tested in Chrome 60 and Firefox 54.
I'm currently binding events to $('body') to work around the issue; the body tag is replaced when going back.

@triskweline

This comment has been minimized.

Contributor

triskweline commented Aug 1, 2017

This issue can be reproduced with jQuery 3, not 2.

@foobear

This comment has been minimized.

Contributor

foobear commented Aug 2, 2017

Thanks for looking into that. Using jQuery 2 is an acceptable workaround for me, until we get this fixed on jQuery 3.

@kratob

This comment has been minimized.

Contributor

kratob commented Oct 11, 2017

I actually cannot confirm this bug. Back button definitely calls destructors on jQuery 3.

However, I've run into an issue where a destructor crashed, causing all later destructors not to be called. The destructor belonged to a compiler outside the content that was usually replaced, so the problem mostly triggered when using the back button, but is actually not caused by the back button in the first place.

@triskweline

This comment has been minimized.

Contributor

triskweline commented Dec 6, 2017

The jQuery 3 part of this issue is fixed with the 0.50.0 release.
You still need to make your destructors not throw errors :)

@triskweline triskweline closed this Dec 6, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment