- From: Peter Burns <notifications@github.com>
- Date: Mon, 17 Jul 2023 12:16:54 -0700
- To: WICG/webcomponents <webcomponents@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
- Message-ID: <WICG/webcomponents/issues/1019/1638729210@github.com>
I needed almost this exact API to add DOM Parts support to our template system workbench: https://github.com/rictic/web-template-workbench/pull/1 As part of writing up a polyfill, I had to make some choices around representing bindings inside an element tag. Code like: ```ts html`<div ${x}></div>` ``` The user intent here is clearly for a NodePart. The template system needs a reference to the `<div>` and will do something to it involving `x`. But for code like: ```ts html`<img src="https://example.com/${name}.png?size=${size}px">` ``` We need to communicate that we've got bindings into the `src` attribute interspersed with constant parts. I represented this with metadata on a node part, with a format similar to a TemplateStringsArray: ```html <?node-part attr src "https://example.com/" ".png?size=" "px" ?> ``` This worked well. Though looking forward towards [template instantiation](https://github.com/WICG/webcomponents/blob/gh-pages/proposals/Template-Instantiation.md), I think we will want an actual AttributePart and the [`attribute value setter`](https://github.com/WICG/webcomponents/blob/gh-pages/proposals/Template-Instantiation.md#41-attribute-value-setter) from Ryosuke's proposal, or something filling the same role, to coordinate multiple AttributeParts, and static strings, without performing multiple writes to the attribute each time the template is updated. -- Reply to this email directly or view it on GitHub: https://github.com/WICG/webcomponents/issues/1019#issuecomment-1638729210 You are receiving this because you are subscribed to this thread. Message ID: <WICG/webcomponents/issues/1019/1638729210@github.com>
Received on Monday, 17 July 2023 19:17:00 UTC