Re: [w3c/webcomponents] [templates] Ensure that template instantiation actually improves the platform (#704)

@dmitriid: Thanks for a very insightful feedback. I love when people give very constructive & detailed feedback based on use cases & case studies like that.

As I stated somewhere before, our approach to template instantiation broadly has three goals:
1. Provide a high performance primitive for template engines & frameworks to build on top of.
2. Provide a minimal high-level template support so that authors don't necessarily rely on a library or a framework to make a good use of templates
3. Provide a common framework by which different template engines & frameworks can work together

I understand that the need for (1) is quite high, and your criticism of the original proposal is understandable because it had many flaws. However, *that* is the point of making a proposal, and we're happy to work with you and the rest of web developer community to figure out the right set of primitives and API surface to add to the platform.

> Template instantiation and updates would have hard time offering anything of value to an approach like this. A friendly native API to tell the browser exactly what you need or a way to declaratively define and provide DOM trees though?

That's more or less `NodeTemplatePart` and `AttributeTemplatePart` aim to provide. When you set a new value to a template part, the browser can figure out whether the change actually needs to propagate to the node or not by figuring out the value change. We didn't include any node diff'ing algorithm into the proposal but it could be done.

We've been working with @justinfagnani from Google to improve our proposal ever since we made the initial proposal, but it would be really helpful to document what you consider to be the ideal API. For example, @WebReflection's proposal about `DocumentFragment` in https://github.com/whatwg/dom/issues/736 has been very useful for us because that's more or less where I started before I eventually warmed up to the idea of `NodeTemplatePart`.

-- 
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/704#issuecomment-478825658

Received on Tuesday, 2 April 2019 03:04:55 UTC