Skip to content

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

@calebdwilliams

Description

@calebdwilliams

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions