Skip to content

feat(jsx): replace innerHtml with clone from template#255

Open
KaiPrince wants to merge 1 commit intoProjectEvergreen:masterfrom
KaiPrince:enhancement/issue-138-ptimize-how-initial-HTML-is-set-on-initial-render-for-JSX-usage
Open

feat(jsx): replace innerHtml with clone from template#255
KaiPrince wants to merge 1 commit intoProjectEvergreen:masterfrom
KaiPrince:enhancement/issue-138-ptimize-how-initial-HTML-is-set-on-initial-render-for-JSX-usage

Conversation

@KaiPrince
Copy link
Contributor

Push the template contents into web component's root instead of setting innerHtml directly. Simplifies the code.

Related Issue

Resolves #138

Summary of Changes

  • Use template clone instead of innerHtml assignment in all cases.
  • Replace the conditional shadowDom/lightDom handling with a single approach, based on the rationale that hasShadowRoot being true means this.attachShadow({ mode: 'open' }) must also have been called.
  • Use textContent = '' to clear existing contents (faster than innerHtml = '')

@KaiPrince KaiPrince changed the title feat(jsx): always clear and clone from template feat(jsx): replace innerHtml with clone from template Mar 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

optimize how initial HTML is set on initial render for JSX usage (Shadow DOM detection)

1 participant