Re: [whatwg/dom] Introduce `moveBefore()` state-preserving atomic move API (PR #1307)

I think that the following scenario is plausible:

```js
try {
  element.moveBefore(newNode, refNode);
} catch {
  element.insertBefore(newNode, refNode);
}  finally {
  // check whether we need to do something extra - e.g. the focused element reparented
  // and some library relies on the side effects
}
```

It's likely that the `finally` clause would be empty in the vast majority of cases, however it's debatable whether it's the platform's job to hide this difference for the sake of ergonomics in a somewhat low-level API like DOM.

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

Message ID: <whatwg/dom/pull/1307/c2492395314@github.com>

Received on Thursday, 21 November 2024 21:41:46 UTC