- From: snuggs <notifications@github.com>
- Date: Sat, 08 Jul 2017 05:13:29 +0000 (UTC)
- To: whatwg/dom <dom@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
- Message-ID: <whatwg/dom/issues/433/313834541@github.com>
@ArkadiuszMichalski @annevk For what it's worth `.after` seemed to be more performant than `.append`. Or perhaps using (yet another) `DocumentFragment` as an intermediary when collecting template iterations was far superior to using `DocumentFragment` in `template.contents`. Seemed fishy to me like although a fragment was still connected to `Document` somehow based on slowness.
Our operation is to have `.bind`able templates that when given a collection yield the template to the current object iteration and finally appending result of template mapping immediately `.after` template.
```html
<ul>
<template name=item>
<li>Hello {name}!</li>
</template>
</ul>
<script nomodule src=//unpkg.com/snuggsi></script>
<script nomodule>
// when context is a collection
const
template = Template `item`
, context = [ {name: 'DevPunk'}, {name: 'Snuggsi'} ]
template
// internal template render for each item in context
.bind (context)
/*
<ul>
<template name=item>
<li>Hello {name}!</li>
</template>
<li>Hello DevPunk!</li>
<li>Hello Snuggsi!</li>
</ul>
*/
</script>
```
May not be relevant but definitely in the same ballpark. I know @annevk is adamant about seeing real world use cases. And I agree.
https://github.com/devpunks/snuggsi/blob/master/elements/html-template-element.es#L35-L44
--
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/433#issuecomment-313834541
Received on Saturday, 8 July 2017 05:14:02 UTC