W3C home > Mailing lists > Public > www-style@w3.org > June 2013

Re: [cssom-view] Is there a need for a plural form of document.caretPositionFromPoint()?

From: Alan Stearns <stearns@adobe.com>
Date: Tue, 25 Jun 2013 09:16:58 -0700
To: Sebastian Zartner <sebastianzartner@gmail.com>, Scott Johnson <sjohnson@mozilla.com>
CC: www-style list <www-style@w3.org>, "Tab Atkins Jr." <jackalmage@gmail.com>
Message-ID: <CDEF0FF5.2CB30%stearns@adobe.com>

One of the use cases for elementsFromPoint was where you're trying to
determine a drop target, but elementFromPoint() is returning the item to
be dropped (since it's the top thing under the cursor). If you want to
have the caret position from an obscured drop target, it would be useful
to have caretPositionsFromPoint().



On 6/25/13 9:11 AM, "Sebastian Zartner" <sebastianzartner@gmail.com> wrote:

>The question is if there is a specific use case, for which you need to
>get the caret position of a covered element and you currently need hacks
>to achieve that, so I can create a report for this.
>On 25 June 2013 17:26, Scott Johnson <sjohnson@mozilla.com> wrote:
>Actually, I think this could be fairly useful. Specifically, it would
>be useful to be able to retrieve the caret position objects, which
>include the node and offset, for every element returned from
>elementFromPoint(). When using the caretPositionFromPoint method, there
>are situations (e.g. with abs-pos) where one element is displayed on
>top of another one. If we returned all possible caret positions for a
>given point, then we would have the option of choosing which one to use
>- an ability we don't currently have.
>On Tue 25 Jun 2013 09:23:09 AM CDT, Sebastian Zartner wrote:
>> In bug 19753[1] I mentioned to add a plural version of
>> document.caretPositionFromPoint() besides the one for
>> document.elementFromPoint(), so you can get the caret positions of all
>> elements at a specific point.
>> Another idea was to add an element-specific function
>> caretPositionFromPoint()[2], which would take coordinates relative to
>> the given element.
>> Now I was asked for possible use cases for this function, though
>> unfortunately I can't remember if I had a good one.
>> One was related to having two overlapping text fields or areas used to
>> enable auto-completion like it's done for the Firebug Command Line.
>> Though there you don't necessarily need the position of the overlapped
>> field.
>> So I'm asking around if somebody sees a need for such a function.
>> Sebastian
>> [1] https://www.w3.org/Bugs/Public/show_bug.cgi?id=19753
>> [2] http://lists.w3.org/Archives/Public/www-style/2012Oct/0702.html
Received on Tuesday, 25 June 2013 16:17:26 UTC

This archive was generated by hypermail 2.4.0 : Friday, 25 March 2022 10:08:31 UTC