From 675ed23a08735020eaeeacf799e2afa5e373f278 Mon Sep 17 00:00:00 2001 From: Owen Buckley Date: Sat, 7 May 2022 17:31:21 -0400 Subject: [PATCH 1/7] config for various ways to omit declarative shadow dom --- src/wcc.js | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/wcc.js b/src/wcc.js index c08c4197..e782770a 100644 --- a/src/wcc.js +++ b/src/wcc.js @@ -9,14 +9,14 @@ import fs from 'node:fs/promises'; let definitions; -async function renderComponentRoots(tree) { +async function renderComponentRoots(tree, includeShadowRoots = true) { for (const node of tree.childNodes) { if (node.tagName && node.tagName.indexOf('-') > 0) { const { tagName } = node; const { moduleURL } = definitions[tagName]; const elementInstance = await initializeCustomElement(moduleURL, tagName, node.attrs); - const shadowRootHtml = elementInstance.getInnerHTML({ includeShadowRoots: true }); + const shadowRootHtml = elementInstance.getInnerHTML({ includeShadowRoots }); const shadowRootTree = parseFragment(shadowRootHtml); // TODO safeguard against non-declared custom elements, e.g. using @@ -25,12 +25,12 @@ async function renderComponentRoots(tree) { } if (node.childNodes && node.childNodes.length > 0) { - await renderComponentRoots(node); + await renderComponentRoots(node, includeShadowRoots); } // does this only apply to `