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

> > 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.
> 
> @noamr There _is_ some precedent for light ergonomics in the DOM already: `child.before`, `child.after`, `parent.append`, and `parent.replaceChildren` all four accepting strings and auto-converting them into text nodes. I feel this could qualify as such "light ergonomics".

Yes, and we can certainly consider adding more ergonomic variants in the future on top of the `moveBefore` behavior, the same way `appendChild` is an ergonomic version of `insertBefore`.
However, `moveBefore` itself, being the first primitive to support the "move" operation, is not that - there is value in making it as single-purpose as possible: it only moves. It doesn't fall back to something else, but fails and notifies the author. 



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

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

Received on Thursday, 21 November 2024 22:20:22 UTC