From ee8458644073866027c73a4324578bbaeb7144e0 Mon Sep 17 00:00:00 2001 From: Steve Orvell Date: Wed, 13 Nov 2013 12:12:56 -0800 Subject: [PATCH] =?UTF-8?q?Addresses=20#79=20by=20adding=20an=20=E2=80=98e?= =?UTF-8?q?ager=E2=80=99=20flag=20to=20upgrade=20elements=20early=20and=20?= =?UTF-8?q?avoid=20fuoc.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/boot.js | 9 +++++---- src/scope.js | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/boot.js b/src/boot.js index d6c7977..a26f2a7 100644 --- a/src/boot.js +++ b/src/boot.js @@ -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() { @@ -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. @@ -56,4 +57,4 @@ if (document.readyState === 'complete') { window.addEventListener(loadEvent, bootstrap); } -})(); +})(window.CustomElements); diff --git a/src/scope.js b/src/scope.js index 57cad1c..63789da 100644 --- a/src/scope.js +++ b/src/scope.js @@ -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:{}}; \ No newline at end of file +window.CustomElements = window.CustomElements || {flags:{}}; \ No newline at end of file