- From: Sebastian Markbåge <notifications@github.com>
- Date: Tue, 26 Mar 2024 14:15:10 -0700
- To: whatwg/dom <dom@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
- Message-ID: <whatwg/dom/issues/1255/2021486232@github.com>
This would be very nice for React since we currently basically just live with things sometimes incorrectly resetting. A couple of notes on the API options: - Associating with the node that gets moved e.g. an option on the `<iframe>` doesn't make much sense because it can be deeply nested inside the tree that moves. The iframe doesn't know anything about which context it moves inside. At best maybe you'd just have to by default add it to all possible nodes that might contain any state - which is all nodes. - Associating with a subtree creates a kind of "mode". Basically for a React app we'd just add it to the entire document, but that also affects any subtrees embedded inside the document which might be an entire legacy app or a different framework. It forces us to basically break the whole app to opt into it. It'd basically be like a new doctype kind of mode. The thing that does causes a change is the place where the move happens. But even then it's kind of random which one gets moved and which one implicitly moves by everything around it moving. We don't remove all children and then reinsert them. So sometimes things preserve state. A new API for insertion/move seems like a better option. We'd basically like to just always the same API for all moves - which can be thousands at a time. This means that this API would have to be really fast - similar to insertBefore. An API like ` append(node, {atomic: true})` doesn't seem good because the allocation and creation of potentially new objects and reading back the value from C++ to JS isn't exactly fast. Since this is a high performance API, this seems like a bad option. Something new like `replaceChildAtomic` would be easy to adopt inside a library and faster. -- Reply to this email directly or view it on GitHub: https://github.com/whatwg/dom/issues/1255#issuecomment-2021486232 You are receiving this because you are subscribed to this thread. Message ID: <whatwg/dom/issues/1255/2021486232@github.com>
Received on Tuesday, 26 March 2024 21:15:14 UTC