Re: [cssom-view]: should caretRangeFromPoint() return NULL for a non-text related node?

On Wed, 07 Oct 2009 18:45:11 +0200, Xiaomei Ji <> wrote:
> Sam implemented caretRangeFromPoint() in
> Webkit<>
> But there is one question we are not sure about: whether NULL should be
> returned if the hit test hits a non-text node.
> Following is extracted from the
> spec<>
> : "(caretRangeFromPoint)..... *must* return an empty text range for the
> position where a text insertion point indicator would have been
> inserted.... or no insertion point indicator would have been inserted,  
> the method *must* return null."
> My understanding is that for a non-text related node (such as an image in
> the  middle of text), since there is no insertion point indicator would  
> have been inserted into it (the image), a NULL range sould be returned  
> if the hit test hits it (the image).
> But I am not sure what is the objective of caretRangeFromPoint().
> I have a specific use case which is to convert the mouse position to
> character position inside a text node. Then returning NULL sounds  
> reasonable for such usage. Here  
> <>is the related webkit bug.
> Would appreciate more background and clarification.

Hmm, I would have expected that in the image scenario you would typically  
get an insertion pointer as well in normal editing conventions. The idea  
was anyway for there to be one since this is a convenience method for  

If someone can propose specification text that works better or maybe a set  
of constraints or something I can try to clarify.

Anne van Kesteren

Received on Thursday, 8 October 2009 08:57:04 UTC