Skip to content

[labs/ssr] Implement ShadowRoot and document/window in event path - #4893

Merged
kyubisation merged 4 commits into
lit:mainfrom
kyubisation:feat-root-node
Apr 26, 2026
Merged

kyubisation merged 4 commits into
lit:mainfrom
kyubisation:feat-root-node

Conversation

@kyubisation

@kyubisation kyubisation commented Jan 15, 2025 •

Copy link
Copy Markdown
Contributor

This PR implements ShadowRoot and document/window in the event path.
For this to work, Node.getRootNode() was implemented as part of the DOM shim, which allows to retrieve the host (if the element is in a Shadow DOM) or document. Due to this, Document and document were moved into the @lit-labs/ssr-dom-shim from the @lit-labs/ssr (relates to #4882).

This also fixes #5178, by not short circuiting on slots with duplicate names.

@changeset-bot

changeset-bot Bot commented Jan 15, 2025 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 8b22fd6

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

This PR includes changesets to release 2 packages
Name Type
@lit-labs/ssr-dom-shim Minor
@lit-labs/ssr Minor

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

@kyubisation

Copy link
Copy Markdown
Contributor Author

@sorvell In the initial SSR events PR you asked for a tree representation for the event path; I tried to add this here: https://github.com/lit/lit/blob/f4d202c8e1391459a67a43a927f1e015b4bc21e2/packages/labs/ssr-dom-shim/src/lib/events.ts
Is this what you were asking for?

@justinfagnani

Copy link
Copy Markdown
Collaborator

@kyubisation

Should Window/window also be part of the composedPath, as it is in the browser?

I think it should be, in case someone is doing path manipulation by index, and assuming that window is there. We do have a window object, we just don't put window on global.

@kyubisation
kyubisation force-pushed the feat-root-node branch 2 times, most recently from c6e6278 to 20d1e4d Compare August 14, 2025 15:24
@kyubisation kyubisation changed the title [labs/ssr] Implement ShadowRoot and document in event path [labs/ssr] Implement ShadowRoot and document/window in event path Aug 14, 2025
@justinfagnani
justinfagnani self-requested a review February 12, 2026 18:30
@kyubisation
kyubisation merged commit 6c051d5 into lit:main Apr 26, 2026
10 of 11 checks passed
kyubisation added a commit to kyubisation/lit that referenced this pull request May 7, 2026
…t#4893)

This implements ShadowRoot and document/window in the event path.
For this to work, `Node.getRootNode()` was implemented as part of the DOM shim, which allows to retrieve the host (if the element is in a Shadow DOM) or document. Due to this, Document and document were moved into the `@lit-labs/ssr-dom-shim` from the `@lit-labs/ssr` (relates to lit#4882).

This also fixes lit#5178, by not short circuiting on slots with duplicate names.
@lit-robot lit-robot mentioned this pull request May 14, 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.

Event target stack incorrect when wa-page is imported

2 participants