Re: Comments on Document Object Model Range

Elena Litani writes, re Range.insertNode:
>However, what happens if the start offset of start boundary point is 0?
>There is nothing to split there! If we do indeed split the Text node, we
>end up with:
>EMPTY text node->inserted Node->the Original TEXT node

GOOD question. Since we didn't say otherwise, I too would assume this means
the Text node is split and an empty Text is produced, just as would be the
case for Text.splitText(0). Note that the same thing may happen when the
offset is immediately following the last character in the Text.

But I also agree that this isn't obvious. At the very least  we should cite
splitText() rather than just saying "split", since the description of
splitText() makes the handling of the boundary conditions more explicit.

(I think we do need to produce the empty Text node, since there may be
Range boundary points anchored at the start or end of the Text and the
insertion should not cause those to move.)



______________________________________
Joe Kesselman  / IBM Research

Received on Thursday, 2 November 2000 13:13:45 UTC