- From: Steve Orvell <notifications@github.com>
- Date: Thu, 21 Nov 2024 09:55:43 -0800
- To: whatwg/dom <dom@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
Received on Thursday, 21 November 2024 17:55:47 UTC
Would it be possible to have this method fallback to `insertBefore` if the conditions for an atomic move are not met? Without this, in practice it seems likely that users will need to write a boilerplate function that tests the 2 nodes for `isConnected` before calling. ```js const moveOrInsertNode = (container, node, ref_node = null) => { const canMove = (container.isConnected && node.isConnected && (!ref_node || ref_node.parentNode === container); return canMove ? container.moveBefore(node, ref_node) : container.insertBefore(node, ref_node); } ``` -- Reply to this email directly or view it on GitHub: https://github.com/whatwg/dom/pull/1307#issuecomment-2491906616 You are receiving this because you are subscribed to this thread. Message ID: <whatwg/dom/pull/1307/c2491906616@github.com>
Received on Thursday, 21 November 2024 17:55:47 UTC