Skip to content
This repository has been archived by the owner on Mar 13, 2018. It is now read-only.

Commit

Permalink
Refine boot logic; should address issue #68
Browse files Browse the repository at this point in the history
  • Loading branch information
sorvell committed Oct 3, 2013
1 parent e269681 commit 5499edd
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/boot.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,17 @@ if (typeof window.CustomEvent !== 'function') {
};
}

// When loading at readyState complete time, boot custom elements immediately.
// If relevant, HTMLImports must already be loaded.
if (document.readyState === 'complete') {
bootstrap();
// When loading at readyState interactive time, bootstrap only if HTMLImports
// are not pending. Also avoid IE as the semantics of this state are unreliable.
} else if (document.readyState === 'interactive' && !window.attachEvent &&
(!window.HTMLImports || window.HTMLImports.ready)) {
bootstrap();
// When loading at other readyStates, wait for the appropriate DOM event to
// bootstrap.
} else {
var loadEvent = window.HTMLImports ? 'HTMLImportsLoaded' : 'DOMContentLoaded';
window.addEventListener(loadEvent, bootstrap);
Expand Down

0 comments on commit 5499edd

Please sign in to comment.