w3c / csswg-drafts

CSS Working Group Editor Drafts
https://drafts.csswg.org/
Other
4.43k stars 656 forks source link

[cssom-view] Specify `document.caretRangeFromPoint`? #6459

Open saschanaz opened 3 years ago

saschanaz commented 3 years ago

Per MDN it has been supported in Chrome and Safari for many years. While there is an alternative, I guess it should probably be in spec for web compatibility, although I haven't investigated its impact.

saschanaz commented 3 years ago

@foolip I see your comment in that mailing list. Per https://www.chromestatus.com/metrics/feature/timeline/popularity/387 the use count is 0.2% which is big enough and I doubt caretPositionFromPoint have lower use count given that it also has been there for years. What do you think, should we specify both?

saschanaz commented 3 years ago

Oh, just found that caretPositionFromPoint is currently Firefox only, I guess it also needs a use counter then.

saschanaz commented 3 years ago

The WebKit implementation simply wraps caretPositionFromPoint, which has never been exposed...

foolip commented 3 years ago

It seems like the current situation is that Chromium and WebKit have caretRangeFromPoint while Gecko has caretPositionFromPoint.

Spec'ing caretRangeFromPoint and caretPositionFromPoint one in terms of the other in a way that would be trivial for all engines to support sounds like the best path forward to me.

There is a risk that these methods are used for UA detection, but other than that I don't see other risks.