Re: [Editing] Replacing `targetRanges` on `InputEvent` by `getTargetRanges`

Sorry for the delayed response...

I think we should not make targetRanges null. We should make it always
populated so that people use that instead of the selection. The upside
there is that their code will naturally work well in the context of IMEs
where using the browser selection won't.

On Tue, Jan 12, 2016 at 5:33 AM Enrica Casucci <enrica@apple.com> wrote:

> If it is used very seldom, one more reason to remove the parameter and
> just provide the method.
>
>         Enrica
>
> > On Jan 9, 2016, at 3:50 PM, Ryosuke Niwa <rniwa@apple.com> wrote:
> >
> > Hi all,
> >
> > We discussed about replacing `targetRanges` on `InputEvent` by
> `getTargetRanges` because an event listener of `beforeinput` event can
> mutate DOM and a subsequent event listener can receive a bad range.  There
> was another concern about the cost of computing the range upfront at the
> event dispatching time.
> >
> > However, it looks like `targetRanges` is almost always NULL except when
> `replaceContent` is used for spelling correction, etc... so perhaps we
> don't need to make this change.
> >
> > Do you remember any other reason why we needed a method instead?
> >
> > - R. Niwa
> >
>
>

Received on Wednesday, 10 February 2016 04:15:54 UTC