Skip to content
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

[ssr-dom-shim]: Add lightweight support for ElementInternals #3676

Closed
1 task done
calebdwilliams opened this issue Feb 16, 2023 · 0 comments · Fixed by #3677
Closed
1 task done

[ssr-dom-shim]: Add lightweight support for ElementInternals #3676

calebdwilliams opened this issue Feb 16, 2023 · 0 comments · Fixed by #3677

Comments

@calebdwilliams
Copy link
Contributor

Should this be an RFC?

  • This is not a substantial change

Which package is this a feature request for?

Other/unknown (please mention in description)

Description

Currently the @lit-labs/ssr-dom-shim package throws when it encounters and element that includes a call to HTMLElement.prototype.attachInternals. This feature is shipped in Chrome, Firefox and Safari Technology Preview and should generally be called in an element's constructor which is one of the methods that will be called by Lit's SSR.

Because Lit uses a lightweight DOM shim, the polyfill cannot add a function to the HTMLElement prototype.

Alternatives and Workarounds

As the author of the element-internals-polyfill I attempted to patch HTMLElement.prototype.attachShadow in that file to no avail. Alternatively component authors could check for the presence of attachInternals in their components but that puts undue burden on Lit's consumers.

calebdwilliams added a commit to calebdwilliams/lit that referenced this issue Feb 16, 2023
* Add a rough implementation for ElementShim.prototype.attachInternals
Fixes lit#3676
augustjk pushed a commit to calebdwilliams/lit that referenced this issue Mar 11, 2023
* Add a rough implementation for ElementShim.prototype.attachInternals
Fixes lit#3676
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 a pull request may close this issue.

1 participant