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

robbiespeed left a comment (whatwg/dom#736)

@WebReflection that's a good question, I expect that the `fragment` would never disappear from the tree (unless manually removed).

<details>
<summary>
A full example for those not following this thread closely
</summary>
```css
ul > li {
  color: purple;
  :first-child {
    color: green;
  }
}
```

```html
<ul>
  <fragment src="/items.html">
    <li>Loading...</li>
  </fragment>
  <li>Last</li>
</ul>
```

When `items.hmtl` is loading, you'd see a list with a green "Loading" item, and a purple "Last" item.

Once `items.html` is loaded the tree would end up something like this:
```html
<ul>
  <fragment src="/items.html">
    <li>First</li>
    <li>Second</li>
  </fragment>
  <li>Last</li>
</ul>
```

Green "First" item, purple "Second" and "Last" items.

From the perspective of CSS `fragment` doesn't exist, but it's children do (appearing as children of the fragments parent). From the perspective of the DOM `fragment` does exist like other elements.
</details>

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

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

Received on Monday, 5 May 2025 20:26:52 UTC