From 55470b20b480fdf919d2f59c385b5d4f57cf5cc9 Mon Sep 17 00:00:00 2001 From: Daniel Freedman Date: Wed, 2 Oct 2013 13:11:08 -0700 Subject: [PATCH] Support asynchronous loading of HTMLImports polyfill --- src/boot.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/boot.js b/src/boot.js index 3ec4897..3dee99c 100644 --- a/src/boot.js +++ b/src/boot.js @@ -26,9 +26,11 @@ function bootstrap() { new CustomEvent('HTMLImportsLoaded', {bubbles: true}) ); }); -}; +} -if (document.readyState === 'complete') { +// Allow for asynchronous loading when minified +// readyState 'interactive' is expected when loaded with 'async' or 'defer' attributes +if (document.readyState === 'complete' || document.readyState === 'interactive') { bootstrap(); } else { window.addEventListener('DOMContentLoaded', bootstrap);