Skip to content

Commit

Permalink
JSX + DSD + inferredObservability sandbox demo working
Browse files Browse the repository at this point in the history
  • Loading branch information
thescientist13 committed Jan 6, 2024
1 parent 9a6311c commit 6c529b5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 12 deletions.
13 changes: 4 additions & 9 deletions sandbox/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,13 @@ <h2>JSX + Light DOM (no JS)</h2>
<h2>JSX + Declarative Shadow DOM (has JS)</h2>

<sb-card-jsx
title="iPhone 9"
thumbnail="https://i.dummyjson.com/data/products/1/thumbnail.jpg"
title="iPhone X"
thumbnail="https://i.dummyjson.com/data/products/2/thumbnail.jpg"
></sb-card-jsx>

<pre>
&lt;sb-card-jsx
title="iPhone 9" thumbnail="https://i.dummyjson.com/data/products/1/thumbnail.jpg"
title="iPhone X" thumbnail="https://i.dummyjson.com/data/products/2/thumbnail.jpg"
&gt;&lt;/sb-card-jsx&gt;
</pre>

Expand All @@ -97,12 +97,7 @@ <h2>JSX + Light DOM + inferredObservability (has JS)</h2>

<hr/>

<!-- TODO - https://github.com/ProjectEvergreen/wcc/issues/128 -->
<h2>JSX + DSD + inferredObservability (has JS) 🚫</h2>

<details>
SSR Shadow DOM and inferredObservability not working, see - https://github.com/ProjectEvergreen/wcc/issues/128
</details>
<h2>JSX + DSD + inferredObservability (has JS)</h2>

<sb-counter-dsd-jsx
count="3"
Expand Down
8 changes: 5 additions & 3 deletions src/jsx-loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -270,11 +270,13 @@ export function parseJsx(moduleURL) {
// https://github.com/ProjectEvergreen/wcc/issues/130
const renderHandler = hasShadowRoot
? `
if(!${elementRoot}.shadowRoot) {
const template = document.createElement('template');
const template = document.createElement('template');
template.innerHTML = \`${serializedHtml}\`;
template.innerHTML = \`${serializedHtml}\`;
if(!${elementRoot}) {
this.shadowRoot.appendChild(template.content.cloneNode(true));
} else {
this.shadowRoot.innerHTML = template.innerHTML;
}
`
: `${elementRoot}.innerHTML = \`${serializedHtml}\`;`;
Expand Down

0 comments on commit 6c529b5

Please sign in to comment.