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

Commit

Permalink
Addresses #79 by adding an ‘eager’ flag to upgrade elements early and…
Browse files Browse the repository at this point in the history
… avoid fuoc.
  • Loading branch information
sorvell committed Nov 13, 2013
1 parent c0deda3 commit ee84586
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
9 changes: 5 additions & 4 deletions src/boot.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Use of this source code is governed by a BSD-style
* license that can be found in the LICENSE file.
*/
(function(){
(function(scope){

// bootstrap parsing
function bootstrap() {
Expand Down Expand Up @@ -40,9 +40,10 @@ if (typeof window.CustomEvent !== 'function') {
};
}

// When loading at readyState complete time, boot custom elements immediately.
// When loading at readyState complete time (or via flag), boot custom elements
// immediately.
// If relevant, HTMLImports must already be loaded.
if (document.readyState === 'complete') {
if (document.readyState === 'complete' || scope.flags.eager) {
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.
Expand All @@ -56,4 +57,4 @@ if (document.readyState === 'complete') {
window.addEventListener(loadEvent, bootstrap);
}

})();
})(window.CustomElements);
2 changes: 1 addition & 1 deletion src/scope.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
* Use of this source code is governed by a BSD-style
* license that can be found in the LICENSE file.
*/
window.CustomElements = {flags:{}};
window.CustomElements = window.CustomElements || {flags:{}};

0 comments on commit ee84586

Please sign in to comment.