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

@sashafirsov in terms of what this is trying to achieve, sure, XML+XSLT seems a good comparison. However there’s a reason those template systems have been suppressed in the past for web technology and data binding in the first place.

They are very limited in developer experience and are in no way close to or as powerful as what we do in modern web development.

Writing an if statement in a string attribute was never an appealing approach, and still isn’t.

What I would live to see, is a low level DOM API that give a template and all the interpolations with data, provides hooks to apply changes in places. So the API does not dictate how the changes should be performed and what syntax or evaluation is best for you, but it simply analyses at compile time the interpolations.

The browser is already able to parse HTML strings in an efficient way, so it could go a step further and tell us “given template x with all the interpolations (syntax to be defined), these are the dynamic parts, the ones that are bound to change due to interpolations”. 

I feel like this could be a good middle ground as frameworks can provide whatever DX they want, leaving the low level mechanism to browsers.

This can be done at compile time for every template, it supports SSR and it’s easy enough for browsers to implement.

It also gives us something lime Solid or Svelte but at runtime (compile runtime actually), rather than having to use a compiler.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/WICG/webcomponents/issues/704#issuecomment-1195192861

You are receiving this because you are subscribed to this thread.

Message ID: <WICG/webcomponents/issues/704/1195192861@github.com>

Received on Tuesday, 26 July 2022 08:49:10 UTC