Skip to content

Commit 0ad5490

Browse files
misc clean and docs
1 parent 1abc030 commit 0ad5490

File tree

5 files changed

+9
-6
lines changed

5 files changed

+9
-6
lines changed

docs/pages/docs.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,6 @@ And so now when the attribute is set on this component, the component will re-re
348348
```
349349
350350
Some notes / limitations:
351-
- Please be aware of the above linked discussion which is tracking known bugs / feature requests to all things WCC + JSX.
351+
- Please be aware of the above linked discussion which is tracking known bugs / feature requests / open items related to all things WCC + JSX.
352352
- 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).
353353
- This automatically _reflects properties used in the `render` function to attributes_, so YMMV.

sandbox/components/card.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
export default class Card extends HTMLElement {
22

33
selectItem() {
4-
alert(`selected item is => ${this.getAttribute('title')}!`);
4+
alert(`selected item is => ${this.title}!`);
55
}
66

77
connectedCallback() {

sandbox/components/card.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ const styles = `
1919
export default class CardJsx extends HTMLElement {
2020

2121
selectItem() {
22-
alert(`selected item is => ${this.getAttribute('title')}!`);
22+
alert(`selected item is => ${this.title}!`);
2323
}
2424

2525
connectedCallback() {

src/jsx-loader.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -266,8 +266,11 @@ export function parseJsx(moduleURL) {
266266
applyDomDepthSubstitutions(elementTree, undefined, hasShadowRoot);
267267

268268
const serializedHtml = serialize(elementTree);
269-
// could / should we do something else instead of .innerHTML for light DOM?
270-
// https://github.com/ProjectEvergreen/wcc/issues/130
269+
// we have to Shadow DOM use cases here
270+
// 1. No shadowRoot, so we attachShadow and append the template
271+
// 2. If there is root from the attachShadow signal, so we just need to inject innerHTML, say in an htmx
272+
// could / should we do something else instead of .innerHTML
273+
// https://github.com/ProjectEvergreen/wcc/issues/138
271274
const renderHandler = hasShadowRoot
272275
? `
273276
const template = document.createElement('template');

test/cases/jsx-shadow-dom/src/heading.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
export default class HeadingComponent extends HTMLElement {
22
sayHello() {
3-
alert('hello world!');
3+
alert(`Hello, ${this.greeting}!`);
44
}
55

66
connectedCallback() {

0 commit comments

Comments
 (0)