You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To help facilitate the contributions and enhancements around #177 and #170 , it was still an open item that users would not have to opt-in to auto-wrapping of the <template> tag when instantiating their Shadow Root in a custom element.
To illustrate, just doing this will automatically wrap the output of WCC in a <template> tag for you
This is based on a combination of Web APIs that we understand to work in tandem, which we are not accurately honoring ( though say some may say that honoring the spec would come at the expense of developer experience ;) )
I am OK with WCC automatically setting serializableShadowRoots: true
Details
I am open to being persuaded to support implied auto-wrapping, but would rather allow a compiler level option to set these automatically instead (through a new issue / PR) but for the sake of this bug report, the expectation would be that the DOM Shim only serializes if it detects serializable: true has been set in the custom element.
This might require "unbreaking" a couple test cases that were changed in #177 but that is fine. Either way we should follow the specs or otherwise document deviations from spec'd behavior, in which case if I am talked out of this, we should document on the home page docs that we do this under attachShadow in the Key Features section.
The text was updated successfully, but these errors were encountered:
thescientist13
changed the title
DOM Shim is automatically inferring serializable as true when calling attachShadow
DOM Shim is automatically inferring serializable option as true when calling attachShadowDec 2, 2024
So I think one thing I may have glossed over was that serializable is read-only property and on top of that, it looks like shadowrootserializable is experimental. I think one of the points @briangrider was getting at in #177 (comment) is that these are really browser only API, and not something meant to be configurable or part of generating DSD, plus there's no mention about any of these in the Google docs re: Declarative Shadow DOM, so I guess we can just leave things as is.
If we find that we've ever implemented the spec wrong or need to provide users more fine-grained control over this behavior, I'm pretty confident with the refactor done in #178 we could easily instrument this I believe.
Type of Change
Bug
Summary
To help facilitate the contributions and enhancements around #177 and #170 , it was still an open item that users would not have to opt-in to auto-wrapping of the
<template>
tag when instantiating their Shadow Root in a custom element.To illustrate, just doing this will automatically wrap the output of WCC in a
<template>
tag for youThis is based on a combination of Web APIs that we understand to work in tandem, which we are not accurately honoring ( though say some may say that honoring the spec would come at the expense of developer experience ;) )
For
getHTML
the spec states that we can consider serializing shadow roots if serializable is set totrue
, e.g.Details
I am open to being persuaded to support implied auto-wrapping, but would rather allow a compiler level option to set these automatically instead (through a new issue / PR) but for the sake of this bug report, the expectation would be that the DOM Shim only serializes if it detects
serializable: true
has been set in the custom element.This might require "unbreaking" a couple test cases that were changed in #177 but that is fine. Either way we should follow the specs or otherwise document deviations from spec'd behavior, in which case if I am talked out of this, we should document on the home page docs that we do this under
attachShadow
in the Key Features section.The text was updated successfully, but these errors were encountered: