The "splice" call

It seems to me the "splice" method of text is lacking definition:

What happens if the element in question already has children?  Are they
deleted?

What happens if the text in question has no parent so it can have no
siblings?

It seems that an exception would be called for (and I am beginning to
think most of these exceptions should be "run time" exceptions when they
represent a programming error because programmers would rarely have
alternate behavior for programming errors).

For that matter, what if the specified element is already a child of
some other element?  I have always thought that an insert or replace (or
splice) should remove first from the existing parent/sibling order, but
I haven't seen that spelled out.

Another natural question is, how about providing the reverse of a splice
operation, which yanks the element out making the children into siblings
of the prior siblings, and joining any ajacent texts back together.

But I guess "splice" type functionality might not be considered so
important a functionality for the core to worry that much about.

Otherwise, I might go on about the need for symetrical functionality
between element iteration and PCDATA iteration.  Splice is just as
useful for elements with children as for text with characters.  For that
matter, iterators are at least as useful for text with characters as in
their current form for elements with children.

Ray Whitmer
ray@corel.com

Received on Tuesday, 19 May 1998 19:32:47 UTC