I'm requesting a TAG review of CSS Custom Highlight API Module Level 1, which was recently published as a FPWD.
The Custom Highlight API extends the concept of highlight pseudo-elements (see CSS Pseudo-Elements 4 §3 Highlight Pseudo-elements) by providing a way for web developers to style the text of arbitrary Range objects, rather than being limited to the user agent defined ::selection, ::spelling-error, and ::grammar-error. This is useful in a variety of scenarios, including editing frameworks that wish to implement their own selection, find-on-page over virtualized documents, multiple selection to represent online collaboration, or spellchecking frameworks. The Custom Highlight API provides a programmatic way of adding and removing highlights that do not affect the underlying DOM structure, but instead applies styles to text based on range objects, accessed via the ::highlight() pseudo element.
To everyone else reviewing: The differences between the explainer and the actual spec are at this point very substantial. I would suggest that people review the spec's own intro section instead of the explainer to get an overview of the current status.
Yes, it is mentioned above in passing, but thought I'd highlight it (pun intended 😁) in case others also start from the explainer by force of habit despite @frivoal's comment, and then realize that all their comments do not apply to the current spec anymore.
@hober and I discussed this today in our VF2F. We noticed that HighlightsRegister is a setlike, but throws when a Highlight object with an existing registered name, which indicates that perhaps maplike would have been more appropriate? It's not ideal developer experience if developers need to iterate the entire data structure before registering their object, to check if an existing one of the same name exists. Maplike would also provide an easy way to get all ranges under a given name.
@hober and I discussed this in a VF2F breakout today. We noticed that the issue we pointed out in our earlier review has now been fixed, so we're happy with its current state and will go ahead and close this. Feel free to open another review if there are substantial changes in the future.