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

Re: [editing] Avoiding selections with no corresponding range, to simplify authoring

From: Boris Zbarsky <bzbarsky@MIT.EDU>
Date: Wed, 11 Jan 2012 11:54:09 -0500
Message-ID: <4F0DBEB1.2040109@mit.edu>
To: public-webapps@w3.org
On 1/11/12 11:41 AM, Aryeh Gregor wrote:
> Also, while I'm at it, how about collapsing at
> (document.documentElement, 0) instead of (document, 0)?

Then you have to handle the case when document.documentElement is null.

And yes, this has come up before; there are scripts out there that 
remove documentElements, do some stuff, insert new documentElements, etc.

> This has the minor added benefit of avoiding Selection boundary points that aren't
> in an Element or Text node

This would happen anyway if you set up a selection inside 
document.documentElement and someone removes the documentElement; the 
normal range algorithm will give you endpoints inside the Document.  so 
you really can't enforce this condition.

Received on Wednesday, 11 January 2012 17:37:14 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 18:13:30 UTC