Re: [Selection] Should selection.getRangeAt return a clone or a reference?

On 01/07/2015 10:08 AM, Koji Ishii wrote:
> While I agree that it's nice, I have mild preference to return a
> clone. As Olii said, changing from clone to live would involve quite a
> bit of code.

I don't think he said that.  He said "implementing the live-ness properly
can be somewhat annoying", which I think refers to implementing updates
on Ranges in general.

As I wrote much of this code in Gecko I agree with what he is saying:
1. updating Ranges in response to DOM mutations is somewhat complex,
2. updating the selection though is simple - if you implement it as a set
    of Ranges you get it for free

I don't think supporting live Ranges here is hard or "would involve
quite a bit of code" (1 does, but not 2).  But UAs must implement 1. for
arbitrary Ranges anyway (per the DOM spec).


/Mats

Received on Friday, 9 January 2015 18:25:04 UTC