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

On 01/24/2015 05:50 PM, Aryeh Gregor wrote:
> On Wed, Jan 21, 2015 at 5:20 PM, Mats Palmgren <mats@mozilla.com> wrote:
>> It seems fine to me.  WebKit/Blink already rejects(*) a range with
>> detached nodes in the addRange call.  Imposing the same restriction on
>> a (live) Selection range is consistent with that.
>
> I don't think it's consistent at all.  In one case, you're calling a
> Selection method.  In the other case, you're calling a Range method.
> Range methods shouldn't behave differently based on whether the Range
> is attached to a Selection.  You actually have no way of telling
> whether a given Range is part of a Selection, right?

Gecko knows if a Range is part of a Selection or not.
It's pretty much a one-line change to reject detached nodes if we want.


 > You can still use the Range methods, you just have to do
 > .removeRange() and .addRange() to update it.  So it's not a
 > significant issue, I think.

True, I'm just saying that I don't see any practical problems in
implementing live ranges to manipulate the Selection if we want to.


/Mats

Received on Saturday, 24 January 2015 23:31:33 UTC