Re: [whatwg/dom] Proposal: a DocumentFragment whose nodes do not get removed once inserted (#736)

FrameMuse left a comment (whatwg/dom#736)

Recently, I brought this idea to address concerns about multi-parenting and unclear traversal strategies.
https://github.com/WebReflection/group-nodes/discussions/12

But as @WebReflection mentioned the idea is not about having a transparent container, but having a reference point in a document to manage nodes without risk of being altered by other scripts unless it is explicitly shared.

Thus @WebReflection suggests that concealing the children from being discovered **from outside<sup>1</sup>** by Tree Walking (i.e. `TreeWalker`, `parentNode`, `firstChild`, `childNodes`, ...) makes sense due to **`ParentNode` nature<sup>2</sup>** since otherwise DOM would need a behaviour no one ever saw before, which brings unknown level of complexity.

_<sup>1</sup> Though `NodeGroup` can be tree walked by the owner - **from inside**_
_<sup>2</sup> FYI, @WebReflection suggests to extend from `DocumentFragment`, which implements `ParentNode`_

@WebReflection also suggests to conceal a reference point (i.e. `NodeGroup` instance) itself from being tree walked as well, which brings alive the statement of encapsulated nodes management - this is the main idea of **current** proposal.

---

@WebReflection Please tell me if I got something wrong 🙏

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

Message ID: <whatwg/dom/issues/736/2833322649@github.com>

Received on Sunday, 27 April 2025 08:29:36 UTC