DOM Range Deletions

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

<FOO>X*Y<BAR>Z*W</BAR>Q</FOO> -> <FOO>X^<BAR>W</BAR>Q</FOO>


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
contents."

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 ")?


Thanks

-- 
Andrew Oakley

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