W3C home > Mailing lists > Public > www-dom@w3.org > April to June 2010

DOM Range Deletions

From: Andrew Oakley <andrew@ado.is-a-geek.net>
Date: Mon, 14 Jun 2010 15:31:48 +0100
Message-ID: <4C163D54.2080506@ado.is-a-geek.net>
To: "www-dom@w3.org" <www-dom@w3.org>
I've been trying to implement DOM Range but can't work out how ranges
are supposed to work under mutation.

In the following examples I use *this* to indicate a range being deleted
and slashes to indicate another range.

Section 2.6 - Deleting Content with a Range gives the example of


Section 2.12.2 - Deletions says:

"If a boundary-point of the original Range is within the content being
deleted, then after the deletion it will be at the same position as the
resulting boundary-point of the (now collapsed) Range used to delete the

We then have the example of:

<P>ABCD efgh T*he <EM>Range*</EM> ijkl</P>
       /               \

Goes to

<P>ABCD <EM>ange</EM> ijkl</P>
           /    \

The two examples seem to operate on documents with the same structure,
and therefore the range being deleted should collapse to the same place
(just before the BAR or EM tag).  Why does the start point of the range
end up inside the "ange" text node rather than in the P with offset 1
(i.e. after "ABCD ")?


Andrew Oakley
Received on Monday, 14 June 2010 14:30:16 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 20 October 2015 10:46:16 UTC