Re: [WICG/webcomponents] [templates] A declarative JavaScript templating API (Issue #1069)

mizchi left a comment (WICG/webcomponents#1069)

I'm prototyping a UI framework and came across this discussion. Let me offer a few comments.

Based on tagged template literals like lit-html doesn't seem like a good idea. Tagged template literals provide sanitization for templates, preventing XSS by ensuring that content doesn't exceed the bounds of string embedding.

In the case of tagged template literals, the ECMA262 specification makes it difficult to extend beyond alternating between split strings and values, and parsing as a tree structure remains the responsibility of the UI library. UI libraries using React or JSX require the direct reception of a parsed DocumentFragment for diffing.

I think what's needed at the DOM API level as a more general primitive is the reverse API of MutationObserver .
In other words, a protocol that accepts an array of `MutationRecord`s and applies them in batches. (How to represent the cumulative difference in node indexes during batch insertion is open to debate.)

I agree that Signal is a good abstraction, but given the history of JQuery, React, Svelte, Sqwik, Solid, etc., I think it's dangerous to say it's a general solution for UI abstractions. If I were to propose a Signal, I think it would be the more generalized AbortSignal.

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

Message ID: <WICG/webcomponents/issues/1069/3654807003@github.com>

Received on Monday, 15 December 2025 10:07:14 UTC