Re: L3 Core: adopting into their existing document

Curt Arnold <carnold@houston.rr.com> wrote:

> Test documentadoptnode28 (unintentionally?) adopts a node into its 
> current document.  Allowing this case seems undesirable

I'm not entirely convinced. I think allowing it could be useful for writing
simpler code in situations where you want an orphan node and you don't care
where it's coming from.

Experience shows destination.importNode(source) where source.ownerDocument
can be destination to be useful even though the spec is (it seems to me)
equally as unclear on the question of whether "another document" is allowed
to be "this document". If the user expectation for adoptNode is "like
importNode but the source disappears" I think it's reasonable to allow it.

Certainly it should either be allowed or throw WRONG_DOCUMENT; a no-op or a
clone are both undesirable as they leave the source document in an
unexpected state. One shouldn't have the same parentNode after being adopted!

-- 
Andrew Clover
mailto:and@doxdesk.com
http://www.doxdesk.com/

Received on Thursday, 8 January 2004 21:09:18 UTC