This repository was archived by the owner on Apr 4, 2025. It is now read-only.
fix(hint): properly clean up when location is changed before DOM content has been loaded#120
Open
gkalpak wants to merge 1 commit intoangular:masterfrom
Open
Conversation
61e135e to
d6fe722
Compare
Narretz
approved these changes
Apr 27, 2017
Narretz
left a comment
There was a problem hiding this comment.
I don't really trust unload and beforeunload, (see e.g. this FF bug https://bugzilla.mozilla.org/show_bug.cgi?id=681636), but I assume you've tested this and it works ;)
…ent has been loaded The `beforeunload` event was never fired if the location was changed before the DOM content had been loaded (e.g. directly inside a `<script>` tag). The `unload` event is fired more consistently. This commit listens for both events to cover more potential browser bugs/edge-cases. Fixes angular/batarang#290
d6fe722 to
97c16a2
Compare
Member
Author
|
This mostly affects batarang (which runs on Chrome only), but I don't see any reason not to play it safe(r), by hooking into both events. At least, this way it will be at least as good as it was before this PR. @Narretz, PTAL. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The
beforeunloadevent was never fired is the location was changed before the DOM content had been loaded (e.g. directly inside a<script>tag. Theunloadevent is fired more consistently.Fixes angular/batarang#290