Skip to content

Commit

Permalink
Explain reason for not using onload event
Browse files Browse the repository at this point in the history
  • Loading branch information
Jaifroid committed Dec 13, 2020
1 parent 83709c0 commit 2fb0130
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions www/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -1350,8 +1350,9 @@ define(['jquery', 'zimArchiveLoader', 'uiUtil', 'settingsStore','abstractFilesys
articleContainer.document.write(htmlArticle);
articleContainer.document.close();
if (appstate.target === 'window') articleContainer.onpopstate = historyPop;
// DEV: It is technically not necessary to load the window in a function, but since different versions of the loading algorithm
// have used an .onload event, or check document.readyState, it is useful to group the functions together like this
// DEV: we can no longer use articleContainer.onload to run this function because IE (and Edge Legacy) do not provide the
// onload event for newly opened windows/tabs. However, document.write followed by document.close is synchronous, so an
// event loader should not be necessary
windowLoaded();

// Calculate the current article's ZIM baseUrl to use when processing relative links
Expand Down

0 comments on commit 2fb0130

Please sign in to comment.