w3c / selection-api

Selection API
http://w3c.github.io/selection-api/
Other
47 stars 30 forks source link

Need an API to get the current caret rects #58

Open rniwa opened 9 years ago

rniwa commented 9 years ago

We need an API to return one, or two in the case of bidi, rects for the current caret position.

caub commented 8 years ago

it works on Firefox, (range.getBoundingClientRect) and should work soon on chrome when they fix it for collapsed ranges

yosinch commented 8 years ago

Isn't CaretPosition.getClientRect() in [1] enough?

BTW, Is bounding box enough for application? It is better to return DOMQuad[2] in CSSOM View API, then we author use DOMQuad.bounds if they want to use bounding rectangle.

[1] https://drafts.csswg.org/cssom-view/ [2] https://www.w3.org/TR/geometry-1/#DOMQuad

rniwa commented 8 years ago

No, CaretPosition.getClientRect() would return one rect but caret could appear at two different locations simultaneously in some browsers.

johanneswilm commented 8 years ago

Yes, or the other way round, at least that's how it currently is. On 16 Mar 2016 12:33 p.m., "Ryosuke Niwa" notifications@github.com wrote:

No, CaretPosition.getClientRect() would return one rect but caret could appear at two different locations simultaneously in some browsers.

— You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub https://github.com/w3c/selection-api/issues/58#issuecomment-197385383