From c4ec5cf15b02811f0ec09981964e2df82c87c508 Mon Sep 17 00:00:00 2001 From: Chris Joel Date: Thu, 29 Oct 2015 16:18:52 -0700 Subject: [PATCH] Don't load imports from templates in the main doc. --- src/Template/Template.js | 2 +- src/WebComponents/build-lite.json | 2 +- tests/Template/imports.html | 61 +++++++++++++++++++++++++++++++ tests/Template/runner.html | 23 ++++++++++++ tests/runner.html | 2 +- webcomponents-lite.js | 2 +- 6 files changed, 88 insertions(+), 4 deletions(-) create mode 100644 tests/Template/imports.html create mode 100644 tests/Template/runner.html diff --git a/src/Template/Template.js b/src/Template/Template.js index 5c99737..284b7d5 100644 --- a/src/Template/Template.js +++ b/src/Template/Template.js @@ -77,7 +77,7 @@ if (typeof HTMLTemplateElement === 'undefined') { }; // auto-bootstrapping for main document - window.addEventListener('DOMContentLoaded', function() { + document.addEventListener('DOMContentLoaded', function() { HTMLTemplateElement.bootstrap(document); }); diff --git a/src/WebComponents/build-lite.json b/src/WebComponents/build-lite.json index 1b194ef..4ad8880 100644 --- a/src/WebComponents/build-lite.json +++ b/src/WebComponents/build-lite.json @@ -3,9 +3,9 @@ "../URL/URL.js", "../WeakMap/WeakMap.js", "../MutationObserver/MutationObserver.js", + "../Template/Template.js", "../HTMLImports/build.json", "../CustomElements/build.json", - "../Template/Template.js", "dom.js", "unresolved.js" ] diff --git a/tests/Template/imports.html b/tests/Template/imports.html new file mode 100644 index 0000000..591b38c --- /dev/null +++ b/tests/Template/imports.html @@ -0,0 +1,61 @@ + + + + + Template with HTMLImports Test + + + + + + + + + + + + diff --git a/tests/Template/runner.html b/tests/Template/runner.html new file mode 100644 index 0000000..1c18c22 --- /dev/null +++ b/tests/Template/runner.html @@ -0,0 +1,23 @@ + + +Template Tests + + + + + diff --git a/tests/runner.html b/tests/runner.html index 777218e..d2603ed 100644 --- a/tests/runner.html +++ b/tests/runner.html @@ -19,7 +19,7 @@ 'WeakMap/tests.html', 'MutationObserver/tests.html', 'HTMLImports/runner.html', - 'Template/tests.html', + 'Template/runner.html', 'CustomElements/runner.html', 'ShadowDOM/runner.html', 'ShadowCSS/runner.html', diff --git a/webcomponents-lite.js b/webcomponents-lite.js index 0640257..6477888 100644 --- a/webcomponents-lite.js +++ b/webcomponents-lite.js @@ -53,9 +53,9 @@ 'URL/URL.js', 'WeakMap/WeakMap.js', 'MutationObserver/MutationObserver.js', + 'Template/Template.js', 'HTMLImports/HTMLImports.js', 'CustomElements/CustomElements.js', - 'Template/Template.js', // these scripts are loaded here due to polyfill timing issues 'WebComponents/dom.js', 'WebComponents/unresolved.js'