W3C home > Mailing lists > Public > www-style@w3.org > October 2009

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

From: Xiaomei Ji <xji@chromium.org>
Date: Wed, 7 Oct 2009 09:45:11 -0700
Message-ID: <a7aebc750910070945i37113725w4fd99c79ea1806de@mail.gmail.com>
To: www-style@w3.org
Sam implemented caretRangeFromPoint() in
Webkit<https://bugs.webkit.org/show_bug.cgi?id=27046>
.

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<http://dev.w3.org/csswg/cssom-view/#the-documentview-interface>
: "(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 <https://bugs.webkit.org/show_bug.cgi?id=29249>is the
related webkit bug.

Would appreciate more background and clarification.

Thanks,
Xiaomei
Received on Wednesday, 7 October 2009 16:45:46 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:20:21 GMT