- From: Valery Zinchenko <notifications@github.com>
- Date: Wed, 16 Apr 2025 03:20:31 -0700
- To: whatwg/dom <dom@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
- Message-ID: <whatwg/dom/issues/736/2809112721@github.com>
FrameMuse left a comment (whatwg/dom#736) https://github.com/whatwg/dom/issues/736#issuecomment-2807940071 > This is an important point to consider. In essence a node could have two parents: a group and the parent of the group. Only one could be representable in the tree as the `parentNode`, and that would have to be the container, not the group, or all kinds of traversal code would break. I find it very brain-breaking as you say `that would **have to** be the container` and then giving the code example of "inconsistency". While also saying `traversal code would break` - Can you tell me why it **has to be** the container? And why this would break the traversal? --- In my view, with a `parentNode` being `NodeGroup`, it's exactly the opposite, since the traversing would go through nodes, then face `NodeGroup`, traverse its nodes, and then continue traversal normally, where is a breaking point? --- While `parentNode` being `NodeGroup`, there is no problem such as > ..., this is no longer always true: ```js parent.children[0].parentNode === parent; ``` Since, in this, it **will* always be `true`. --- > Now maybe this is ok because DocumentFragment is already kind of weird by emptying its children into a container it's appended into, and never having a parent itself, but it definitely breaks some assumptions you could previously make about nodes. I'm sorry for pushing this really hard, but I think you misunderstood something since - we don't want to use `DocumentFragment`, but create a brand new node as the one that you're saying you would like to see yourself: > I know that may be impossible now, but it would be really nice if we could introduce a new element that was allowed anywhere like a script supporting element, but that renders, so also with a transparent content model, and if there were a new CSS display value similar to contents that also hid the element from combinators like > and pseudo-classes like :nth-child(). A practically invisible element, named like <g> or something. It would solve serialization naturally. Knowing that an `Element` is `Node`, `NodeChild` and `NodeParent` - I see that we've just made a full cycle back to what I proposed (https://github.com/whatwg/dom/issues/736#issuecomment-2804689564). --- Tell me if I got your points incorrectly. -- Reply to this email directly or view it on GitHub: https://github.com/whatwg/dom/issues/736#issuecomment-2809112721 You are receiving this because you are subscribed to this thread. Message ID: <whatwg/dom/issues/736/2809112721@github.com>
Received on Wednesday, 16 April 2025 10:20:35 UTC