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

The proposal as is is imminently useful for its purpose of marking areas for DOM updates. The only motivation for server templates to leverage this is to co-operate with the client for dynamic updates.

At current there is an open question of what defaults will look like, which as it stands is not part of the initial iteration. I anticipate defaults will provide the opportunity for server template languages to converge on the DOM parts syntax as an output format, and maybe as an authoring format. During the 2023 Spring F2F we discussed the default syntax, some ideas were to use something like `{{someExpr;default value}}`. The default value would be initially rendered, but the part would remain exposed as the expression (so `someExpr` in the example).

With defaults template languages could use server generated values as the default while marking the part as an area for dynamic updates. Existing template languages could expose each area of dynamic content using existing syntax or new syntax. As an example an erb-like server template language might take:

```erb
<div><%= locals.username %></div>
```

and turn it into:

```html
<div>{{ username ; "keithamus" }}</div>
```

On the initial parse the default is displayed, but upon dynamic updates the client can pull out the `username` expression to supply new values.

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

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

Received on Sunday, 10 December 2023 11:57:51 UTC