

DOM Range Deletions

Date: Mon, 14 Jun 2010 15:31:48 +0100
Message-ID: <4C163D54.2080506@ado.is-a-geek.net>
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 GMT
