If insertBefore() of DocumentFragment encounters hierarchy error. ..

(ie, if one of the children of the Fragment is not something that can be
inserted into the target node)... What's the expected behavior?

There are three obvious choices:

1) Insert up to the point where the conflict exists, leave it and anything
following in the DocumentFragment. Reasonable, trivial to implement. And
since it's what I'm currently doing, I'm slightly biased toward it.

2) Scan all the kids before insertion starts, and throw the exception if
any of them are unacceptable. Reasonable, a bit more overhead but far from
unacceptable, and arguably a bit more robust.

3) Copy all the kids which can be copied, leaving only the problem children
in the DocumentFragment. A bit less reasonable, I think, but also easy to
implement.

______________________________________
Joe Kesselman  / IBM Research
Unless stated otherwise, all opinions are solely those of the author.

Received on Thursday, 10 September 1998 17:36:37 UTC