ryansolid / dom-expressions

A Fine-Grained Runtime for Performant DOM Rendering
MIT License
863 stars 125 forks source link

Issue with webcomponents that have HTML Comment elements #337

Open spion opened 1 month ago

spion commented 1 month ago

Some webcomponents (like Ionic's ion-label) generate additional comment children

For those, the code frragment

https://github.com/ryansolid/dom-expressions/blob/8d2d82fd96a08c82b933fcf87ef521c4b54cf490/packages/dom-expressions/src/client.js#L428

is going to try and update the comment rather than the actual text content.

A repro that isn't very minimal: https://stackblitz.com/edit/github-pyx5ga?file=package.json,app%2Fclient.tsx,vite.config.js,index.html,app%2Fionic-css.ts

You will notice that <IonLabel /> generates empty comment elements, which in turn cause SolidJS to update them if the only child of the component is a string

ryansolid commented 5 days ago

Our system works by walking known nodes, I don't don't know if there is anything to be done here. I'm open to suggestions but if something changes the shape of the HTML from what the JSX outputs we aren't going to know where things are.