Re: [WICG/webcomponents] agAST: A counter-proposal to dom-parts? (Issue #1106)

conartist6 left a comment (WICG/webcomponents#1106)

I thought about it some more.

The system I would propose is closer to how React works, with a JS-land shadow-DOM which is designed to be easy to sync back to the native DOM. In terms of capabilities for JS it solves the problem of how to declaratively describe a the contents of a `<template>` or a set of changes that you want

I designed my DOM tree with a heavy dose of inspiration from Immutable.js. The tree nodes are deeply immutable and writes create trees that have structural sharing with each other (at the node and sub-node level). This makes it cheap to hold the before and after trees so that you can run a diffing algorithm to execute only the necessary changes and recomputations to the mutable structure, a design that React has proven can work well.

To make diffing fast my system gives each node a hash computed from the combination of its semantic and syntactic structure, so if any subtree's content has the same hash on either side of a change, then we know that we don't need to update that part of the native/mutable DOM.





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

Message ID: <WICG/webcomponents/issues/1106/3089315666@github.com>

Received on Friday, 18 July 2025 12:24:28 UTC