Intent to Prototype: Custom Highlight API

146 views
Skip to first unread message

Sanket Joshi (Edge)

unread,
Feb 11, 2021, 4:56:56 AMFeb 11
to blink-dev, ffi...@microsoft.com, pc...@microsoft.com, ikilp...@chromium.org, chri...@chromium.org, mason...@chromium.org, Yoshifumi Inoue
Contact emails
The custom highlight API provides a way for web developers to style the text of arbitrary ranges. 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 selections to represent online collaboration, or spellchecking frameworks.

Blink component
Blink>Editing

Motivation
With the lack of this functionality in the browser today, web developers and framework authors are forced to modify the underlying structure of the DOM tree in order to achieve the rendering they desire. This can quickly become complicated in cases where the desired highlight spans elements across multiple subtrees, and also requires DOM updates in order to adjust highlights as they change. The custom highlight API provides a programmatic way of adding and removing highlights that does not affect the underlying DOM structure, but instead applies styles to text based on range objects.

TAG review
Issues open

Risks

Interoperability and Compatibility

Low: This feature received positive support from Safari and Firefox at TPAC 2019. Safari is implementing this, Firefox has not yet made any indication on implementation.


Gecko: Positive

WebKit: In development

Web developers: Strongly positive

Ergonomics

The highlight API will be one of the first use cases of constructible static ranges. Static ranges are preferred over Iive ranges because they do not incur cost during DOM mutations; however, post DOM changes, static ranges need to be validated before they can be used. We need to assess the perf impact of these static range validity checks once we have some real-world usage.



Activation

No. Web developers should be able to use the feature as-is. It is also easy to feature detect.



Debuggability

DevTools should be able to show ::highlight pseudo elements, in the same way that it shows other pseudo elements.



Is this feature fully tested by web-platform-tests?
No

Tracking bug
https://crbug.com/1164461

Link to entry on the Chrome Platform Status

Chris Harrelson

unread,
Feb 11, 2021, 11:16:59 AMFeb 11
to Sanket Joshi (Edge), blink-dev, ffi...@microsoft.com, pc...@microsoft.com, Ian Kilpatrick, Mason Freed, Yoshifumi Inoue
Hi, comment below.

On Thu, Feb 11, 2021 at 1:56 AM 'Sanket Joshi (Edge)' via blink-dev <blin...@chromium.org> wrote:

Gecko: Positive

WebKit: In development

Web developers: Strongly positive

Can you please link to evidence for these according to the defined process?
 

Sanket Joshi (Edge)

unread,
Feb 11, 2021, 3:05:34 PMFeb 11
to blink-dev, Chris Harrelson, blink-dev, ffi...@microsoft.com, pc...@microsoft.com, ikilp...@chromium.org, Mason Freed, Yoshifumi Inoue, Sanket Joshi (Edge)
Gecko:
https://github.com/w3c/csswg-drafts/issues/4307#issuecomment-531543832
This is a fairly old sign of support. I have not heard any plans from Firefox to start implementing this API, but they have been involved in various issue discussions in W3C/WHATWG and have not voiced any objections.

WebKit:
https://developer.apple.com/safari/technology-preview/release-notes/
It looks like WebKit has actually shipped the highlight API.

Web developers:
There is significant support expressed in this issue: [css-pseudo-4] Proposal: Highlight API · Issue #4307 · w3c/csswg-drafts (github.com).
CKEditor has shown support from the early days of the highlight API explainer.

Chris Harrelson

unread,
Feb 11, 2021, 3:24:41 PMFeb 11
to Sanket Joshi (Edge), blink-dev, ffi...@microsoft.com, pc...@microsoft.com, ikilp...@chromium.org, Mason Freed, Yoshifumi Inoue
On Thu, Feb 11, 2021 at 12:05 PM 'Sanket Joshi (Edge)' via blink-dev <blin...@chromium.org> wrote:


On Thursday, February 11, 2021 at 8:16:59 AM UTC-8 Chris Harrelson wrote:
Hi, comment below.

On Thu, Feb 11, 2021 at 1:56 AM 'Sanket Joshi (Edge)' via blink-dev <blin...@chromium.org> wrote:

Gecko: Positive

WebKit: In development

Web developers: Strongly positive

Can you please link to evidence for these according to the defined process?

Gecko:
https://github.com/w3c/csswg-drafts/issues/4307#issuecomment-531543832
This is a fairly old sign of support. I have not heard any plans from Firefox to start implementing this API, but they have been involved in various issue discussions in W3C/WHATWG and have not voiced any objections.

This does not count. See https://bit.ly/blink-signals
 

WebKit:
https://developer.apple.com/safari/technology-preview/release-notes/
It looks like WebKit has actually shipped the highlight API.

Web developers:
There is significant support expressed in this issue: [css-pseudo-4] Proposal: Highlight API · Issue #4307 · w3c/csswg-drafts (github.com).
CKEditor has shown support from the early days of the highlight API explainer.

--
You received this message because you are subscribed to the Google Groups "blink-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/c5d3a07d-6bd4-4afc-997a-857384822e6fn%40chromium.org.

Sanket Joshi (Edge)

unread,
Feb 11, 2021, 6:05:56 PMFeb 11
to blink-dev, Chris Harrelson, blink-dev, ffi...@microsoft.com, pc...@microsoft.com, ikilp...@chromium.org, Mason Freed, Yoshifumi Inoue, Sanket Joshi (Edge)
On Thursday, February 11, 2021 at 12:24:41 PM UTC-8 Chris Harrelson wrote:
On Thu, Feb 11, 2021 at 12:05 PM 'Sanket Joshi (Edge)' via blink-dev <blin...@chromium.org> wrote:


On Thursday, February 11, 2021 at 8:16:59 AM UTC-8 Chris Harrelson wrote:
Hi, comment below.

On Thu, Feb 11, 2021 at 1:56 AM 'Sanket Joshi (Edge)' via blink-dev <blin...@chromium.org> wrote:

Gecko: Positive

WebKit: In development

Web developers: Strongly positive

Can you please link to evidence for these according to the defined process?

Gecko:
https://github.com/w3c/csswg-drafts/issues/4307#issuecomment-531543832
This is a fairly old sign of support. I have not heard any plans from Firefox to start implementing this API, but they have been involved in various issue discussions in W3C/WHATWG and have not voiced any objections.

This does not count. See https://bit.ly/blink-signals

I see. Thanks for the pointer. I have changed this to "No Signal" for now, and sent out a request-for-position here: Custom Highlight API · Issue #482 · mozilla/standards-positions (github.com).
Reply all
Reply to author
Forward
0 new messages