- From: Noam Rosenthal <notifications@github.com>
- Date: Mon, 25 Nov 2024 03:08:54 -0800
- To: whatwg/dom <dom@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
Received on Monday, 25 November 2024 11:08:58 UTC
> Option B is obviously using the wrong methods though ... a disconnected fragment (which is all fragments) that uses `moveBefore` makes no sense ... I'd rather have that method overridden with a throwing for `DocumentFragment` class but I understand that case could be true for any offline node too (if I understand this API correctly) ... although, we have: > > ```js > if (parent.isConnected) > parent.moveBefore(node, ref_node); > else > parent.insertBefore(node, ref_node); > ``` > > AFAIK that's not the end of the story though, the operation can fail in other occasions too ... the accessor I've mentioned also wouldn't work, a method such as `parent.canMoveNode(node)` would be better, still without any need to throw on `moveBefore` as your use case is probably the edge one, not the most common one, for when `moveBefore` is desired imho. It would only fail when moving between connected/disconnected nodes, across documents, or when trying nonsensical things like moving comment nodes. What are those "other occasions"? -- Reply to this email directly or view it on GitHub: https://github.com/whatwg/dom/issues/1255#issuecomment-2497705792 You are receiving this because you are subscribed to this thread. Message ID: <whatwg/dom/issues/1255/2497705792@github.com>
Received on Monday, 25 November 2024 11:08:58 UTC