W3C home > Mailing lists > Public > public-webapps@w3.org > January to March 2015

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

From: Mats Palmgren <matspal@gmail.com>
Date: Fri, 09 Jan 2015 18:24:33 +0000
Message-ID: <54B01CE1.6040906@mozilla.com>
To: Koji Ishii <kojiishi@gmail.com>, Tim Down <tim@timdown.co.uk>
CC: Ryosuke Niwa <rniwa@apple.com>, Webapps WG <public-webapps@w3.org>, Olli Pettay <olli@pettay.fi>
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

This archive was generated by hypermail 2.3.1 : Friday, 27 October 2017 07:27:25 UTC