Re: [csswg-drafts] [css-highlight-api] Use marker nodes to declaratively annotate highlights (#13381)

This is a nice idea. My main question is whether marks can select specific ranges of text within a single text node like this:
```html
<div>
  Earlier stuff<!start name="some-range">Stuff<!end name="some-range">Later stuff
</div>
```

If not, it might not work for most usage of highlight API. That ability to style a substring in a text node without wrapping the substring in another element is the main point of Highlight API, because if the substring is wrapped in another element then that element can be styled directly.

> 2. See how to coordinate the scope of resolving the name

Names in the [HighlightRegistry](https://developer.mozilla.org/en-US/docs/Web/API/HighlightRegistry) are global to the document (including shadow roots), so that might need to be the scoping for the declarative approach too.

> 3. We might need a new type of AbstractRange, as those ranges are not exactly live ranges.

Can it be `StaticRange`?

> 4. See how we can express priority/type.

Attributes on `<!mark>`, maybe?
```html
<!start name="some-range" type="spelling-error" priority="2">
Stuff
<!end name="some-range">
```

-- 
GitHub Notification of comment by dandclark
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/13381#issuecomment-3786209252 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Thursday, 22 January 2026 19:10:22 UTC