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

> I wonder if that choice of error tolerance could be moved to a boolean argument. Like, `parent.moveBefore(child, refNode, true)` to tolerate failure to move (like a missing custom element move callback) and `parent.moveBefore(child, refNode, false)` to throw on failure, or vice versa. That could be an acceptable compromise.

This particular API shape is a boolean trap, but I think we can can consider variants in the future that have an 'move if you can insert if you can't' behavior. But this is a slightly higher level behavior than moving. As I said, there is value in having at least some DOM APIs that are as primitive as possible.

> Also, how does this handle the case of `parent` and `child` having different `Document`s? If I'm understanding correctly, an exception is thrown, but that's just a guess that checking "shadow-including root" equality implies that.

It throws when moving across documents.

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

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

Received on Thursday, 21 November 2024 22:24:07 UTC