Re: [WICG/webcomponents] DOM parts use outside of <template> seems unlikely (Issue #1035)

I think there are some interesting ideas in there. I particularly like this idea, even independent of declarative elements:

```css
@host attribute(to: location.path) { 
  ...
}
```

I don't know that the article makes a strong enough case for creating an entirely new declarative language though, and one only for DCEs. That seems like an even bigger ask than handling this through HTML. I also don't see why an equivalent HTML wouldn't be just as good. For example, something like this:

```html
<element id="NavLink" state="{{this.to === location.path ? 'current' : null}}">
  <attr name="to" prop></attr>

  <style>
    a[aria-current="page"] {
      text-decoration: none;
      color: inherit;
    }
  </style>

  <view shadowrootmode="open">
    <a part="link" href={{this.to}} aria-current="{{this.to === location.path ? 'page' : null}}">
      <slot></slot>
    </a>
  </view>
</element>
```

Regarding the article's DCE idea, I'm not sure how more complex scenarios would work. How is conditional rendering and list rendering handled? How do we handle rendering to the Light DOM instead of the Shadow DOM? How do we handle form association? etc. How does registration work? How does that relate to HTML Modules? For me, there are a lot of questions about the idea. I'd need to see those things addressed to be convinced of this approach. Personally, I'm open to being convinced, I just need more of the idea expanded to support a broader set of scenarios.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/WICG/webcomponents/issues/1035#issuecomment-1959804810
You are receiving this because you are subscribed to this thread.

Message ID: <WICG/webcomponents/issues/1035/1959804810@github.com>

Received on Thursday, 22 February 2024 16:24:48 UTC