Wildhoney / ReactShadow

:beginner: Utilise Shadow DOM in React with all the benefits of style encapsulation.
https://react-shadow.herokuapp.com/
MIT License
1.29k stars 80 forks source link

template content is empty with react #141

Closed VinayKrMittal closed 1 year ago

VinayKrMittal commented 1 year ago

when I try to get the content of template in react using template.content then it always gives empty response, because react using template.appendChild instead of template.content.appendChild and we get empty response (https://stackoverflow.com/questions/70677604/template-content-is-an-empty-document-fragment). so, we have to use dangerouslySetInnerHTML to set the content in template tag (https://stackoverflow.com/questions/42845195/how-can-i-render-a-template-tag-with-react) and it should be updated in package itself.

Need to get template content as this feature is experimental (https://caniuse.com/declarative-shadow-dom) and not supported by all the browser and we are adding polyfill for the same.

VinayKrMittal commented 1 year ago

Fix has been merged in MR https://github.com/Wildhoney/ReactShadow/pull/142. Closing this issue.