Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[ssr] Consider supporting HTMLElement.shadowRoot in SSR dom-shim. #2652

@nicholasrice

Description

@nicholasrice

Description

I noticed today that the default dom-shim in @lit-labs/ssr does not implement the HTMLElement.shadowRoot property. Specifically, invoking attachShadow() with an open shadow-root configuration does not cause the created shadow root for the element to be exposed from the shadowRoot property; it only returns the shadow root object.

I know that you're trying to keep the dom-shim lean, but I was wondering if you would consider a PR that implements the shadow root getter behavior.

For context, I'm working on FAST's SSR implementation. We're hoping to align to the same dom-shim constraints as Lit, however, FAST only caches shadow root references for elements defined with a closed shadow root. In open shadow root cases, the shadow root will simply be retrieved from the element's shadowRoot property anytime the shadow root needs to be manipulated or inspected. This is currently causing a core code path to throw.

I'm sure we can adjust our runtime or dom-shim code to accommodate this gap, but I thought I would file an issue with ya'll first to see if this is a feature you're interested in taking. I'm happy to put up a PR if it is.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    ✅ Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions