Re: [WICG/webcomponents] Addressable comments (a very small DOM parts subset) (Issue #1116)

sorvell left a comment (WICG/webcomponents#1116)

I want to mostly echo https://github.com/WICG/webcomponents/issues/1116#issuecomment-3525964584. It's a nice advancement if we can have a performance win by avoiding the tree walk. Just to be clear, it has to be faster than something like:

```js
function collectComments(root: Node = document): Comment[] {
  const walker = document.createTreeWalker(root, NodeFilter.SHOW_COMMENT);
  const comments: Comment[] = [];
  let node: Comment | null;
  while (node = walker.nextNode() as Comment | null) comments.push(node);
  return comments;
}
```

Other than that...

- I think it's possible easily to extract any attribute/event/property info into a comment that's say the first child of an element. 
- Supporting ranges in text only elements (mostly style) would be really great as well, and putting the comment *after* the entire element makes parsing the input trickier.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/WICG/webcomponents/issues/1116#issuecomment-3549086013
You are receiving this because you are subscribed to this thread.

Message ID: <WICG/webcomponents/issues/1116/3549086013@github.com>

Received on Tuesday, 18 November 2025 19:03:57 UTC