Skip to content

Commit

Permalink
misc clean and docs
Browse files Browse the repository at this point in the history
  • Loading branch information
thescientist13 committed Jan 6, 2024
1 parent 1abc030 commit 0ad5490
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion docs/pages/docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,6 @@ And so now when the attribute is set on this component, the component will re-re
```
Some notes / limitations:
- Please be aware of the above linked discussion which is tracking known bugs / feature requests to all things WCC + JSX.
- Please be aware of the above linked discussion which is tracking known bugs / feature requests / open items related to all things WCC + JSX.
- We consider the capability of this observability to be "coarse grained" at this time since WCC just re-runs the entire `render` function, replacing of the `innerHTML` for the host component. Thought it is still WIP, we are exploring a more ["fine grained" approach](https://github.com/ProjectEvergreen/wcc/issues/108) that will more efficient than blowing away all the HTML, a la in the style of [**lit-html**](https://lit.dev/docs/templates/overview/) or [**Solid**'s Signals](https://www.solidjs.com/tutorial/introduction_signals).
- This automatically _reflects properties used in the `render` function to attributes_, so YMMV.
2 changes: 1 addition & 1 deletion sandbox/components/card.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export default class Card extends HTMLElement {

selectItem() {
alert(`selected item is => ${this.getAttribute('title')}!`);
alert(`selected item is => ${this.title}!`);
}

connectedCallback() {
Expand Down
2 changes: 1 addition & 1 deletion sandbox/components/card.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const styles = `
export default class CardJsx extends HTMLElement {

selectItem() {
alert(`selected item is => ${this.getAttribute('title')}!`);
alert(`selected item is => ${this.title}!`);
}

connectedCallback() {
Expand Down
7 changes: 5 additions & 2 deletions src/jsx-loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -266,8 +266,11 @@ export function parseJsx(moduleURL) {
applyDomDepthSubstitutions(elementTree, undefined, hasShadowRoot);

const serializedHtml = serialize(elementTree);
// could / should we do something else instead of .innerHTML for light DOM?
// https://github.com/ProjectEvergreen/wcc/issues/130
// we have to Shadow DOM use cases here
// 1. No shadowRoot, so we attachShadow and append the template
// 2. If there is root from the attachShadow signal, so we just need to inject innerHTML, say in an htmx
// could / should we do something else instead of .innerHTML
// https://github.com/ProjectEvergreen/wcc/issues/138
const renderHandler = hasShadowRoot
? `
const template = document.createElement('template');
Expand Down
2 changes: 1 addition & 1 deletion test/cases/jsx-shadow-dom/src/heading.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export default class HeadingComponent extends HTMLElement {
sayHello() {
alert('hello world!');
alert(`Hello, ${this.greeting}!`);
}

connectedCallback() {
Expand Down

0 comments on commit 0ad5490

Please sign in to comment.