- From: Mason Freed <notifications@github.com>
- Date: Thu, 02 Apr 2020 18:23:40 -0700
- To: whatwg/dom <dom@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
- Message-ID: <whatwg/dom/issues/831/608177935@github.com>
> > b. In the "backwards" case, the `attachShadow()` call from the component "wins" the race. Then the declarative content finishes parsing, and the parser tries to attach the declarative shadow root. In this case, that attachment will fail, and the declarative contents will be discarded. Here again, not performance-ideal, but everything keeps working correctly. > > I don't think this behavior is acceptable. There needs to be a way for a component to let the declarative content arrive into its shadow root. Maybe we need an option to attachShadow which indicates whether the declarative content could be inserted or not. Again here, there are two kinds of components we're talking about here. For "DSR unaware" components, all we're going for is "not broken". And I think we agree that this case is ok. For "DSR aware" components, which I think is what you're talking about when you request a new option to `attachShadow()`, the `ElementInternals.shadowRoot` can be used to *not* call `attachShadow()` and wait for the declarative content instead. Wouldn't that allow your use case? > Also, this poses another problem. Since the component would never know when the children had finished parsing, there is no point in which the component is safe to attach a shadow root until your sibling or your ancestor's sibling starts appearing. Having to write that kind of code manually everywhere seems very fragile & developer hostile. So it sounds like you think we need to solve the [parser finished / children changed](https://github.com/w3c/webcomponents/issues/809) problem. I agree (and it sounds like many developers do also) that we should solve that problem. However, I'm hoping we can avoid tying these two proposals together. There are myriad other problems that are also waiting on that solution, so this will just be one more such problem. Let's work on that one also! But let's not stall DSR while we wait. -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/whatwg/dom/issues/831#issuecomment-608177935
Received on Friday, 3 April 2020 01:23:54 UTC