diff --git a/element/element.js b/element/element.js index c1f8d83..4e3f20b 100644 --- a/element/element.js +++ b/element/element.js @@ -121,6 +121,7 @@ export default function LiteralElement(tag, lifecycle = {}, properties = {}) { const consts = { host: this, shadow, internals }; const renderer = Literal.fromFragment(name, template.content, this, consts); + shadow.appendChild(renderer.content); // Call lifecycle.construct() diff --git a/literal-element/modules/lifecycle.js b/literal-element/modules/lifecycle.js index 1d17db0..1a86cdc 100644 --- a/literal-element/modules/lifecycle.js +++ b/literal-element/modules/lifecycle.js @@ -39,16 +39,18 @@ export default { internals.attributes.reduce(assignProperty, {}) : nothing ; - if (internals.src) { - internals.src.then((module) => { - // TODO: can't we just pass module as scope? Why not? - const scope = assign({}, module); - delete scope.default; - defineElement(internals.tag, this, module.default || {}, attributes, scope) - }); - } - else { - defineElement(internals.tag, this, {}, attributes, {}); - } + return [render(() => { + if (internals.src) { + internals.src.then((module) => { + // TODO: can't we just pass module as scope? Why not? + const scope = assign({}, module); + delete scope.default; + defineElement(internals.tag, this, module.default || {}, attributes, scope) + }); + } + else { + defineElement(internals.tag, this, {}, attributes, {}); + } + })]; } } diff --git a/literal-html/module.js b/literal-html/module.js index 89c5da3..fd7cd52 100644 --- a/literal-html/module.js +++ b/literal-html/module.js @@ -16,9 +16,10 @@ library provides another template, `