8000 [labs/ssr] Implement ShadowRoot and document in event path by kyubisation · Pull Request #4893 · lit/lit · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

kyubisation
Copy link
Contributor
@kyubisation kyubisation commented Jan 15, 2025

This PR implements ShadowRoot and document 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).

To discuss:

  • Should Window/window also be part of the composedPath, as it is in the browser?
  • Having Node.getRootNode() would allow a new pattern for getting a root event target. This would allow us to deprecate litServerRoot, which was initially accepted as a compromise to facilitate @lit/context use cases.

Copy link
changeset-bot bot commented Jan 15, 2025

🦋 Changeset detected

Latest commit: f4d202c

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
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
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.

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 participants
0