[ssr] Consider supporting `HTMLElement.shadowRoot` in SSR dom-shim.
See original GitHub issueDescription
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.
Issue Analytics
- State:
- Created a year ago
- Comments:5 (5 by maintainers)
Top GitHub Comments
Great, I’ll put up a PR then. Thanks!
Yeah, if it’s just a matter of assigning the faux shadowRoot to
this.shadowRoot
, seems fine.Want to be pragmatic about enabling common patterns without being super strict or heavyweight.