Skip to content

fix(web): keep template clones in the active document - #5274

Open
akzarma wants to merge 1 commit into
solidjs:mainfrom
akzarma:fix-safari-template-owner-document-5249
Open

akzarma wants to merge 1 commit into
solidjs:mainfrom
akzarma:fix-safari-template-owner-document-5249

Conversation

@akzarma

@akzarma akzarma commented Nov 30, 2026

Copy link
Copy Markdown

Summary

Closes #5249.

A standard template clone comes from the inert document behind <template>. Inserting a separately constructed custom element into that detached clone moves its subtree into the inert document. In WebKit 26.4, an unupgraded custom element inside the child's shadow root can then remain unupgraded after the parent is connected.

Adopt the cached HTML/SVG root into the active document before cloning it. Keep the flag-1 importNode path for custom-element templates unchanged. No public API changes.

How did you test this change?

  • Ran pnpm install --frozen-lockfile and pnpm exec turbo run build --filter=@solidjs/web --concurrency=2.
  • Ran pnpm --filter @solidjs/web exec vitest run test/template-owner-document.spec.ts test/template-trusted-types.spec.ts --maxWorkers=2. Two owner-document assertions fail on main and all six tests pass with the patch.
  • Ran a focused nested-shadow-root reproduction against the baseline and patched template functions in Playwright. In WebKit 26.4 the inner element failed to upgrade on main and upgraded with the patch. In Chromium it upgraded in both versions.

Assisted by OpenAI Codex.

@changeset-bot

changeset-bot Bot commented Nov 30, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: e18599c

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 5 packages
Name Type
@solidjs/web Patch
@solidjs/diagnostics Patch
@solidjs/signals Patch
solid-js Patch
@solidjs/universal Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

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.

[2.0.4] Nested Shadow DOM custom elements fail to upgrade in Safari when mounted inside non-custom-element templates

1 participant