Re: proposal to expose word breaker through JavaScript

This is the Microsoft version: range.expand
http://msdn.microsoft.com/en-us/library/ms536421%28VS.85%29.aspx


2009/7/29 Anne van Kesteren <annevk@opera.com>:
> On Wed, 29 Jul 2009 02:42:04 +0200, Xiaomei Ji <xji@chromium.org> wrote:
>> We are proposing the following API to expose word breaker through
>> JavaScript.
>> document.extendRange(range, "word")
>>  It extends the passed-in range to a range in word boundary.
>>  If the passed-in range is an empty range, in which the beginning and
>> ending
>> are the same, the empty range will be extended to a one-word range covers
>> the beginning/ending of passed-in range. In the case where the
>> beginning/ending of passed-in range is at a word boundary, the logically
>> next word will be selected.
>>
>> If the beginning and ending of the passed-in range are not the same, the
>> range is extended to word boundary on both sides. Which means the
>> beginning will be extended to the word boundary on its logically left side if it is
>> not at a word boundary, and ending will be extended to the word boundary
>> on its logically right side if it is not at a word boundary.
>>
>> Please let us know if there is any issues, concerns with the proposal.
>
> Initially I did not quite understand what this API was proposing, but after reading it a few times it seems to mimic the behavior of what typically happens when you double-click a "word".
>
> I'm still not quite sure whether I understand the API though. Is "word" a keyword on how the range is to be extended or is it an example? Also, wouldn't it be better to put the method on Range rather than Document?
>
> And finally, use cases would help as well as a definition of "word boundary" and how this works/won't work in an international context.
>
> Cheers,
>
>
> --
> Anne van Kesteren
> http://annevankesteren.nl/
>
>

Received on Wednesday, 29 July 2009 13:50:10 UTC