Re: [whatwg/dom] Add convenient, ergonomic, performant API for sorting siblings (#586)

What if instead of fixing this as a sorting problem, we treat it as a batched-update problem, and present an API that does specifically that?

e.g. (strawman) a function that takes an array of remove/insertAdjacentElement calls
and performs them atomically, leaving all side effects (including iframe reloads, mutation events, scripts, anything) to after it's done:

```js
document.executeBatchUpdates([
   { remove: node },
   { insert: [parent, child, 'afterbegin'] }
])
```

Side note: at Wix we had to jump through crazy hoops because of the state-reset-at-reparent-or-reorder issue, this is far from being an exotic problem in my experience.


-- 
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/dom/issues/586#issuecomment-1548212768
You are receiving this because you are subscribed to this thread.

Message ID: <whatwg/dom/issues/586/1548212768@github.com>

Received on Monday, 15 May 2023 16:55:38 UTC