- From: Thomas Di Grégorio <notifications@github.com>
- Date: Mon, 06 Apr 2020 08:20:28 -0700
- To: w3c/webcomponents <webcomponents@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
Received on Monday, 6 April 2020 15:20:41 UTC
Another thought:
Maybe even template's content understanding can be part of browser job. There is already a good API for template string in JS, the same parser can be used, and transform the content with data-attributes values :
```
<template data-who="Doctor" in-place>Hello ${who} !</template>
<template data-who="Doctor" xlink:data-include="#part" in-place>
<span>Hello ${who} !</span>
<div>${include}</div>
</template>
<span id="part">o_O</span>
```
Delegating simple substitution to the browser-land, without needing JS for simple string or element replacement make it possible to use templates with no-script option.
```
<template data-who="Doctor" src="welcome.html">placecholder</template>
```
Then JS authors can still get the template's source and use it as usualy...
And finally, the ability to use another template with a `use` attribute like the one in SVG :
```
<template id="welcomer" src="welcome.html"></template>
<div>
<template xlink:use="#welcomer" data-who="Doctor"></template>
<template xlink:use="#welcomer" data-who="Master"></template>
<template xlink:use="#welcomer" data-who="Galifrey"></template>
</div>
```
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3c/webcomponents/issues/849#issuecomment-609859669
Received on Monday, 6 April 2020 15:20:41 UTC