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

The "splice" call

From: Ray Whitmer <ray@corel.com>
Date: Tue, 19 May 1998 17:32:46 -0600
Message-ID: <3562169E.D51A72D7@corel.com>
To: www-dom@w3.org
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 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Friday, 22 June 2012 06:13:45 GMT