Skip to content
This repository has been archived by the owner on Jul 10, 2024. It is now read-only.

Commit

Permalink
Don't init until readyState is complete, to prevent missing document.…
Browse files Browse the repository at this point in the history
…body errors in IE. H/T @matthargett.
  • Loading branch information
zackbloom committed Dec 9, 2013
1 parent c123ab2 commit 55c8c84
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion coffee/ui.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ init = ->
flashClass 'offline-ui-reconnect-succeeded-2s', 2
flashClass 'offline-ui-reconnect-succeeded-5s', 5

if document.readyState in ['interactive', 'complete']
if document.readyState is 'complete'
init()
else if document.addEventListener?
document.addEventListener 'DOMContentLoaded', init, false
Expand Down
4 changes: 2 additions & 2 deletions js/ui.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
(function() {
var RETRY_TEMPLATE, TEMPLATE, addClass, content, createFromHTML, el, flashClass, flashTimeouts, formatTime, init, removeClass, render, _onreadystatechange, _ref;
var RETRY_TEMPLATE, TEMPLATE, addClass, content, createFromHTML, el, flashClass, flashTimeouts, formatTime, init, removeClass, render, _onreadystatechange;

if (!window.Offline) {
throw new Error("Offline UI brought in without offline.js");
Expand Down Expand Up @@ -138,7 +138,7 @@
});
};

if ((_ref = document.readyState) === 'interactive' || _ref === 'complete') {
if (document.readyState === 'complete') {
init();
} else if (document.addEventListener != null) {
document.addEventListener('DOMContentLoaded', init, false);
Expand Down
2 changes: 1 addition & 1 deletion offline.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 55c8c84

Please sign in to comment.