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

noamr created an issue (WICG/webcomponents#1116)

One of the use cases that keeps coming up for DOM parts is being able to have a reference to a part of the DOM that is not directly tied to elements.

See https://github.com/WICG/declarative-partial-updates/issues/6 and https://github.com/whatwg/dom/issues/736.

The way frameworks often do this today is by creating comment nodes and keeping reference to them.
What if we implemented exactly that?

Allow some sort of string syntax inside a comment that makes it efficiently addressable from a DOM API, but it's a comment node for all other purposes (e.g. it's not stylable, doesn't affect `nth-child`, doesn't appear in `querySelector` etc).

That comment is there *only* for the purpose of being addressable.

Some use examples::
- we can have `<template contentmethod>` patches able to stream between a pair of these.
- a JS API can keep it as a stable reference into a table and replace multiple rows

The syntax inside the comment can be similar to a data URL, e.g. `marker:key=value;addressable-name`, but I'm sure people here are more opionated than myself about this part.

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

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

Received on Thursday, 13 November 2025 07:04:38 UTC